Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
paula-stacho committed Jul 10, 2024
1 parent 896322b commit cef73cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 10 additions & 4 deletions packages/compass-collection/src/components/collection-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from './collection-tab-stats';
import type { CollectionSubtab } from '@mongodb-js/compass-workspaces';
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';
import { useConnectionInfoAccess } from '@mongodb-js/compass-connections/provider';

function trackingIdForTabName(name: string) {
return name.toLowerCase().replace(/ /g, '_');
Expand Down Expand Up @@ -119,18 +120,23 @@ const CollectionTabWithMetadata: React.FunctionComponent<
stats,
}) => {
const track = useTelemetry();
const connectionInfoAccess = useConnectionInfoAccess();
const { log, mongoLogId } = useLogger('COMPASS-COLLECTION-TAB-UI');
useEffect(() => {
const activeSubTabName = currentTab
? trackingIdForTabName(currentTab)
: null;

if (activeSubTabName) {
track('Screen', {
name: activeSubTabName,
});
track(
'Screen',
{
name: activeSubTabName,
},
connectionInfoAccess.getCurrentConnectionInfo()
);
}
}, [currentTab, track]);
}, [currentTab, track, connectionInfoAccess]);
const pluginTabs = useCollectionSubTabs();
const pluginModals = useCollectionScopedModals();

Expand Down
6 changes: 4 additions & 2 deletions packages/compass/src/app/components/entrypoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import { LoggerProvider } from '@mongodb-js/compass-logging/provider';
import { TelemetryProvider } from '@mongodb-js/compass-telemetry/provider';
import { getAppName, getAppVersion } from '@mongodb-js/compass-utils';
import Home, { type HomeProps } from './home';
import { createIpcSendTrack } from '@mongodb-js/compass-telemetry';
import type { TelemetryServiceOptions } from '@mongodb-js/compass-telemetry/dist/generic-track';
import {
type TelemetryServiceOptions,
createIpcSendTrack,
} from '@mongodb-js/compass-telemetry';

const WithPreferencesAndLoggerProviders: React.FC = ({ children }) => {
const loggerProviderValue = useRef({
Expand Down

0 comments on commit cef73cb

Please sign in to comment.