Skip to content
Merged
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
9 changes: 9 additions & 0 deletions apps/desktop/src/renderer/hooks/useIsV2CloudEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { FEATURE_FLAGS } from "@superset/shared/constants";
import { useFeatureFlagEnabled } from "posthog-js/react";
import { useV2LocalOverrideStore } from "renderer/stores/v2-local-override";

const IS_DEV = process.env.NODE_ENV === "development";

/**
* Returns effective v2 state: remote PostHog flag AND local opt-in.
* Also returns the raw remote flag so the toggle can be shown conditionally.
Expand All @@ -11,6 +13,13 @@ export function useIsV2CloudEnabled() {
useFeatureFlagEnabled(FEATURE_FLAGS.V2_CLOUD) ?? false;
const optInV2 = useV2LocalOverrideStore((s) => s.optInV2);

if (IS_DEV) {
return {
isV2CloudEnabled: true,
isRemoteV2Enabled: true,
};
}

return {
/** The effective value — use this wherever you previously checked the flag directly. */
isV2CloudEnabled: remoteV2Enabled && optInV2,
Expand Down
Loading