Skip to content

Commit e9a0971

Browse files
committed
move trackpageload call to dbmetaepics
1 parent 924814e commit e9a0971

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/browser/modules/App/App.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ import {
9696
updateUdcData
9797
} from 'shared/modules/udc/udcDuck'
9898
import { getTelemetrySettings } from 'shared/utils/selectors'
99-
import { trackPageLoad } from 'shared/modules/preview/previewDuck'
10099

101100
export const MAIN_WRAPPER_DOM_ID = 'MAIN_WRAPPER_DOM_ID'
102101

@@ -150,11 +149,6 @@ export function App(props: any) {
150149
props.bus && props.bus.send(initAction.type, initAction)
151150
}, [props.bus])
152151

153-
useEffect(() => {
154-
const pageLoadAction = trackPageLoad()
155-
props.bus && props.bus.send(pageLoadAction.type, pageLoadAction)
156-
}, [props.bus, props.telemetrySettings.allowUserStats])
157-
158152
const {
159153
browserSyncAuthStatus,
160154
browserSyncConfig,

src/shared/modules/dbMeta/dbMetaEpics.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
getCurrentDatabase
9898
} from 'shared/utils/selectors'
9999
import { isBoltConnectionErrorCode } from 'services/bolt/boltConnectionErrors'
100+
import { trackPageLoad } from '../preview/previewDuck'
100101

101102
function handleConnectionError(store: any, e: any) {
102103
if (!e.code || isBoltConnectionErrorCode(e.code)) {
@@ -546,6 +547,12 @@ export const serverConfigEpic = (some$: any, store: any) =>
546547
store.dispatch(triggerCredentialsTimeout())
547548
}
548549

550+
setTimeout(() => {
551+
// Track page load after server config is done
552+
// setTimeout ensures telemetry settings have been propagated to the App
553+
store.dispatch(trackPageLoad())
554+
})
555+
549556
return Rx.Observable.of(null)
550557
})
551558
})

src/shared/modules/preview/previewDuck.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('previewDuck tests', () => {
4848
const [action] = store.getActions()
4949
expect(action).toEqual({
5050
type: PREVIEW_EVENT,
51-
label: 'ui-switch',
51+
label: 'PREVIEW_UI_SWITCH',
5252
data: {
5353
switchedTo: 'preview',
5454
timeSinceLastSwitch: null
@@ -113,7 +113,7 @@ describe('previewDuck tests', () => {
113113
const [action] = store.getActions()
114114
expect(action).toEqual({
115115
type: PREVIEW_EVENT,
116-
label: 'page-load',
116+
label: 'PREVIEW_PAGE_LOAD',
117117
data: { previewUI: false, hasTriedPreviewUI: false }
118118
})
119119
done()

src/shared/modules/preview/previewDuck.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const trackNavigateToPreview = (): PreviewEventAction => {
4747

4848
return {
4949
type: PREVIEW_EVENT,
50-
label: 'ui-switch',
50+
label: 'PREVIEW_UI_SWITCH',
5151
data: {
5252
switchedTo: 'preview',
5353
timeSinceLastSwitch: timeSinceLastSwitch
@@ -60,7 +60,7 @@ export const trackPageLoad = (): PreviewEventAction => {
6060

6161
return {
6262
type: PREVIEW_EVENT,
63-
label: 'page-load',
63+
label: 'PREVIEW_PAGE_LOAD',
6464
data: { previewUI: false, hasTriedPreviewUI }
6565
}
6666
}

0 commit comments

Comments
 (0)