Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: wait for licenseData to resolve before the check to show chat support (#6091)

Yunus M3b7455ac4cfb
diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx
index 8400afbde3..846ec02ac4 100644
--- a/frontend/src/AppRoutes/index.tsx
+++ b/frontend/src/AppRoutes/index.tsx
@@ -12,6 +12,7 @@ import useAnalytics from 'hooks/analytics/useAnalytics';
import { KeyboardHotkeysProvider } from 'hooks/hotkeys/useKeyboardHotkeys';
import { useIsDarkMode, useThemeConfig } from 'hooks/useDarkMode';
import { THEME_MODE } from 'hooks/useDarkMode/constant';
+import useFeatureFlags from 'hooks/useFeatureFlag';
import useGetFeatureFlag from 'hooks/useGetFeatureFlag';
import useLicense, { LICENSE_PLAN_KEY } from 'hooks/useLicense';
import { NotificationProvider } from 'hooks/useNotifications';
@@ -58,23 +59,16 @@ function App(): JSX.Element {
const isDarkMode = useIsDarkMode();
- const featureResponse = useGetFeatureFlag((allFlags) => {
- const isOnboardingEnabled =
- allFlags.find((flag) => flag.name === FeatureKeys.ONBOARDING)?.active ||
- false;
+ const isOnboardingEnabled =
+ useFeatureFlags(FeatureKeys.ONBOARDING)?.active || false;
- const isChatSupportEnabled =
- allFlags.find((flag) => flag.name === FeatureKeys.CHAT_SUPPORT)?.active ||
- false;
+ const isChatSupportEnabled =
+ useFeatureFlags(FeatureKeys.CHAT_SUPPORT)?.active || false;
- const isPremiumSupportEnabled =
- allFlags.find((flag) => flag.name === FeatureKeys.PREMIUM_SUPPORT)?.active ||
- false;
-
- const showAddCreditCardModal =
- !isPremiumSupportEnabled &&
- !licenseData?.payload?.trialConvertedToSubscription;
+ const isPremiumSupportEnabled =
+ useFeatureFlags(FeatureKeys.PREMIUM_SUPPORT)?.active || false;
+ const featureResponse = useGetFeatureFlag((allFlags) => {
dispatch({
type: UPDATE_FEATURE_FLAG_RESPONSE,
payload: {
@@ -90,16 +84,6 @@ function App(): JSX.Element {
setRoutes(newRoutes);
}
-
- if (isLoggedInState && isChatSupportEnabled && !showAddCreditCardModal) {
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
- window.Intercom('boot', {
- app_id: process.env.INTERCOM_APP_ID,
- email: user?.email || '',
- name: user?.name || '',
- });
- }
});
const isOnBasicPlan =
@@ -201,6 +185,26 @@ function App(): JSX.Element {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname]);
+ useEffect(() => {
+ const showAddCreditCardModal =
+ !isPremiumSupportEnabled &&
+ !licenseData?.payload?.trialConvertedToSubscription;
+
+ if (isLoggedInState && isChatSupportEnabled && !showAddCreditCardModal) {
+ window.Intercom('boot', {
+ app_id: process.env.INTERCOM_APP_ID,
+ email: user?.email || '',
+ name: user?.name || '',
+ });
+ }
+ }, [
+ isLoggedInState,
+ isChatSupportEnabled,
+ user,
+ licenseData,
+ isPremiumSupportEnabled,
+ ]);
+
useEffect(() => {
if (user && user?.email && user?.userId && user?.name) {
try {