Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: new app views feature flag ready wait causing infinite loading (#6255)

dev-rbe979a2d18996
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 2154711596..51361d7e47 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -49,8 +49,10 @@ import { EmptyStatePanel } from '@ui';
import {
type Component,
createRenderEffect,
+ createSignal,
type JSXElement,
lazy,
+ onCleanup,
onMount,
Show,
} from 'solid-js';
@@ -66,14 +68,21 @@ function usePageViewTracking(pageTitle: string) {
});
}
+const NEW_APP_VIEWS_FLAG_WAIT_MS = 5_000;
+
function useNewAppViews(options?: {
enabledLayout?: () => 'legacy' | 'composable';
}) {
const panel = useSplitPanelOrThrow();
- const posthog = usePosthog();
const flag = useFeatureFlag(enableNewAppViews);
- const ready = () =>
- enableNewAppViews.override !== undefined || posthog.flagsLoaded();
+ const [timedOut, setTimedOut] = createSignal(false);
+ const timer = setTimeout(() => setTimedOut(true), NEW_APP_VIEWS_FLAG_WAIT_MS);
+ onCleanup(() => clearTimeout(timer));
+
+ // PostHog can be blocked or fail before invoking its flag callback. Bound
+ // the loading state so these views fall back to their legacy equivalents
+ // instead of displaying a loading block forever.
+ const ready = () => !flag().loading || timedOut();
const enabled = () => ready() && flag().enabled;
createRenderEffect(() => {