mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 18:29:00 +08:00
fix: theme analytics not getting reported as user is being fetched delayed (#5162)
This commit is contained in:
parent
35c054835a
commit
c53e6de689
@ -178,9 +178,10 @@ function App(): JSX.Element {
|
|||||||
}, [pathname]);
|
}, [pathname]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (user && user?.email && user?.userId && user?.name) {
|
||||||
try {
|
try {
|
||||||
const isThemeAnalyticsSent = getLocalStorageApi(
|
const isThemeAnalyticsSent = getLocalStorageApi(
|
||||||
LOCALSTORAGE.THEME_ANALYTICS,
|
LOCALSTORAGE.THEME_ANALYTICS_V1,
|
||||||
);
|
);
|
||||||
if (!isThemeAnalyticsSent) {
|
if (!isThemeAnalyticsSent) {
|
||||||
trackEvent('Theme Analytics', {
|
trackEvent('Theme Analytics', {
|
||||||
@ -188,13 +189,14 @@ function App(): JSX.Element {
|
|||||||
user: pick(user, ['email', 'userId', 'name']),
|
user: pick(user, ['email', 'userId', 'name']),
|
||||||
org,
|
org,
|
||||||
});
|
});
|
||||||
setLocalStorageApi(LOCALSTORAGE.THEME_ANALYTICS, 'true');
|
setLocalStorageApi(LOCALSTORAGE.THEME_ANALYTICS_V1, 'true');
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
console.error('Failed to parse local storage theme analytics event');
|
console.error('Failed to parse local storage theme analytics event');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, [user]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfigProvider theme={themeConfig}>
|
<ConfigProvider theme={themeConfig}>
|
||||||
|
@ -18,5 +18,5 @@ export enum LOCALSTORAGE {
|
|||||||
DASHBOARD_VARIABLES = 'DASHBOARD_VARIABLES',
|
DASHBOARD_VARIABLES = 'DASHBOARD_VARIABLES',
|
||||||
SHOW_EXPLORER_TOOLBAR = 'SHOW_EXPLORER_TOOLBAR',
|
SHOW_EXPLORER_TOOLBAR = 'SHOW_EXPLORER_TOOLBAR',
|
||||||
PINNED_ATTRIBUTES = 'PINNED_ATTRIBUTES',
|
PINNED_ATTRIBUTES = 'PINNED_ATTRIBUTES',
|
||||||
THEME_ANALYTICS = 'THEME_ANALYTICS',
|
THEME_ANALYTICS_V1 = 'THEME_ANALYTICS_V1',
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export function ThemeProvider({ children }: ThemeProviderProps): JSX.Element {
|
|||||||
setTheme(THEME_MODE.LIGHT);
|
setTheme(THEME_MODE.LIGHT);
|
||||||
set(LOCALSTORAGE.THEME, THEME_MODE.LIGHT);
|
set(LOCALSTORAGE.THEME, THEME_MODE.LIGHT);
|
||||||
}
|
}
|
||||||
set(LOCALSTORAGE.THEME_ANALYTICS, '');
|
set(LOCALSTORAGE.THEME_ANALYTICS_V1, '');
|
||||||
}, [theme]);
|
}, [theme]);
|
||||||
|
|
||||||
const value = useMemo(
|
const value = useMemo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user