Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions app/client/src/ce/sagas/userSagas.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -190,29 +190,34 @@ export function* getCurrentUserSaga(action?: {
}
}

function* intializeSmartLook(currentUser: User) {
if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) {
yield AnalyticsUtil.identifyUser(currentUser);
}
}
Comment on lines +193 to +197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo in function name

The function name has a typo. It should be "initialize" instead of "intialize".

Apply this diff to fix the typo:

-function* intializeSmartLook(currentUser: User) {
+function* initializeSmartLook(currentUser: User) {

The implementation looks good otherwise.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function* intializeSmartLook(currentUser: User) {
if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) {
yield AnalyticsUtil.identifyUser(currentUser);
}
}
function* initializeSmartLook(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());
}
}
}

if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) {
enableTelemetry && AnalyticsUtil.identifyUser(currentUser);
}

const isFFFetched: boolean = yield select(getFeatureFlagsFetched);

if (!isFFFetched) {
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/pages/Editor/HelpButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
});
Expand Down