diff --git a/app/client/src/ce/sagas/userSagas.tsx b/app/client/src/ce/sagas/userSagas.tsx index 4e881be6fc5e..76fdb329ccb0 100644 --- a/app/client/src/ce/sagas/userSagas.tsx +++ b/app/client/src/ce/sagas/userSagas.tsx @@ -1,4 +1,4 @@ -import { call, put, race, select, take } from "redux-saga/effects"; +import { call, fork, put, race, select, take } from "redux-saga/effects"; import type { ReduxAction, ReduxActionWithPromise, @@ -190,18 +190,27 @@ export function* getCurrentUserSaga(action?: { } } +function* intializeSmartLook(currentUser: User) { + if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) { + yield AnalyticsUtil.identifyUser(currentUser); + } +} + export function* runUserSideEffectsSaga() { const currentUser: User = yield select(getCurrentUser); const { enableTelemetry } = currentUser; const isAirgappedInstance = isAirgapped(); if (enableTelemetry) { - const promise = initializeAnalyticsAndTrackers(); + // parallelize sentry and smart look initialization - if (promise instanceof Promise) { - const result: boolean = yield promise; + yield fork(intializeSmartLook, currentUser); + const initializeSentry = initializeAnalyticsAndTrackers(); - if (result) { + if (initializeSentry instanceof Promise) { + const sentryInialized: boolean = yield initializeSentry; + + if (sentryInialized) { yield put(segmentInitSuccess()); } else { yield put(segmentInitUncertain()); @@ -209,10 +218,6 @@ export function* runUserSideEffectsSaga() { } } - if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) { - enableTelemetry && AnalyticsUtil.identifyUser(currentUser); - } - const isFFFetched: boolean = yield select(getFeatureFlagsFetched); if (!isFFFetched) { diff --git a/app/client/src/pages/Editor/HelpButton.tsx b/app/client/src/pages/Editor/HelpButton.tsx index f0c656f875d8..186f2a8bb129 100644 --- a/app/client/src/pages/Editor/HelpButton.tsx +++ b/app/client/src/pages/Editor/HelpButton.tsx @@ -102,7 +102,7 @@ export function IntercomConsent({ const instanceId = useSelector(getInstanceId); const dispatch = useDispatch(); - const sendUserDataToIntercom = () => { + const sendUserDataToIntercom = async () => { const { email } = user || {}; updateIntercomProperties(instanceId, user); @@ -115,7 +115,7 @@ export function IntercomConsent({ showIntercomConsent(false); if (user?.enableTelemetry) { - AnalyticsUtil.identifyUser(user, true); + await AnalyticsUtil.identifyUser(user, true); AnalyticsUtil.logEvent("SUPPORT_REQUEST_INITIATED", { email, });