diff --git a/app/client/src/ce/sagas/userSagas.tsx b/app/client/src/ce/sagas/userSagas.tsx index 76fdb329cc..42f5cfa837 100644 --- a/app/client/src/ce/sagas/userSagas.tsx +++ b/app/client/src/ce/sagas/userSagas.tsx @@ -43,7 +43,6 @@ import { import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { INVITE_USERS_TO_WORKSPACE_FORM } from "ee/constants/forms"; import type { User } from "constants/userConstants"; -import { ANONYMOUS_USERNAME } from "constants/userConstants"; import { flushErrorsAndRedirect, safeCrashAppRequest, @@ -190,9 +189,15 @@ export function* getCurrentUserSaga(action?: { } } -function* intializeSmartLook(currentUser: User) { - if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) { - yield AnalyticsUtil.identifyUser(currentUser); +function* initTrackers(currentUser: User) { + const initializeSentry = initializeAnalyticsAndTrackers(currentUser); + + const sentryInitialized: boolean = yield initializeSentry; + + if (sentryInitialized) { + yield put(segmentInitSuccess()); + } else { + yield put(segmentInitUncertain()); } } @@ -202,20 +207,7 @@ export function* runUserSideEffectsSaga() { const isAirgappedInstance = isAirgapped(); if (enableTelemetry) { - // parallelize sentry and smart look initialization - - yield fork(intializeSmartLook, currentUser); - const initializeSentry = initializeAnalyticsAndTrackers(); - - if (initializeSentry instanceof Promise) { - const sentryInialized: boolean = yield initializeSentry; - - if (sentryInialized) { - yield put(segmentInitSuccess()); - } else { - yield put(segmentInitUncertain()); - } - } + yield fork(initTrackers, currentUser); } const isFFFetched: boolean = yield select(getFeatureFlagsFetched); diff --git a/app/client/src/utils/AppsmithUtils.tsx b/app/client/src/utils/AppsmithUtils.tsx index 0fad6ec8df..c86e6bd2f0 100644 --- a/app/client/src/utils/AppsmithUtils.tsx +++ b/app/client/src/utils/AppsmithUtils.tsx @@ -13,8 +13,10 @@ import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReduc import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { CreateNewActionKeyInterface } from "ee/entities/Engine/actionHelpers"; import { CreateNewActionKey } from "ee/entities/Engine/actionHelpers"; +import { ANONYMOUS_USERNAME } from "../constants/userConstants"; +import type { User } from "constants/userConstants"; -export const initializeAnalyticsAndTrackers = async () => { +export const initializeAnalyticsAndTrackers = async (currentUser: User) => { const appsmithConfigs = getAppsmithConfigs(); try { @@ -106,6 +108,10 @@ export const initializeAnalyticsAndTrackers = async () => { Sentry.captureException(e); log.error(e); } + + if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) { + await AnalyticsUtil.identifyUser(currentUser); + } }; export const mapToPropList = (map: Record): Property[] => {