[Bug]: D_TEST feature flag does not update UI when PostHog finishes loading
What's the bug?
Summary
The dashboard currently reads the DASHBOARD_V4_EXPERIMENT feature flag using getFeatureFlag() during render. Since getFeatureFlag() returns a synchronous snapshot and does not subscribe to PostHog feature flag updates, the UI can remain on the default experiment variant if PostHog finishes loading after the initial render.
Affected Components packages/dashboard/src/router/AppRoutes.tsx packages/dashboard/src/layout/AppSidebar.tsx Current Behavior
AppRoutes and AppSidebar determine whether the D_TEST variant is active by calling getFeatureFlag() during render.
If the PostHog client has not finished loading feature flags yet, these components render using the default variant and are not automatically updated when the feature flags become available.
Expected Behavior
Components that depend on the DASHBOARD_V4_EXPERIMENT feature flag should react automatically when PostHog resolves feature flags, without requiring an unrelated re-render or a full page refresh.
Possible Direction
posthog-js/react already provides reactive feature flag hooks (such as useFeatureFlagVariantKey) that subscribe to feature flag updates. Using the reactive API for render-time feature flag checks would keep the UI synchronized with PostHog once feature flags are loaded.
How to reproduce
No response
Environment (optional)
No response
Source: InsForge/InsForge