ENG-1479: Port suggestive mode settings to dual-read#845
Conversation
Add dual-read routing to getFeatureFlag for flags with legacy counterparts. FEATURE_FLAG_LEGACY_MAP maps "Suggestive mode enabled" and "Enable left sidebar" to their config tree reads, gated by isNewSettingsStoreEnabled(). Flags without legacy entries go straight to block props (no behavior change). Migrate value reads from getFormattedConfigTree() / extensionAPI.settings to accessors: - index.ts: getUidAndBooleanSetting → getFeatureFlag (accessor handles legacy fallback now) - AdminPanel: suggestiveModeEnabled.value → getFeatureFlag in both FeatureFlagsTab and main component. Removed unused useMemo. - SuggestiveModeSettings: includePageRelations state init → getGlobalSetting. Dropped initialValue from both GlobalFlagPanels. - hyde.ts: orphan extensionAPI.settings.get() reads → getGlobalSetting. Fixes bug where sync config toggles had no runtime effect (keys were never written by any code). Structural UIDs remain with getFormattedConfigTree(). pageGroups.groups NOT migrated — type mismatch (legacy PageGroup has UIDs, Zod PageGroup does not). Deferred to ENG-1470.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis PR migrates feature flag access from legacy config-tree paths to a centralized mechanism via Changes
Sequence DiagramsequenceDiagram
participant Component as Component<br/>(e.g., AdminPanel)
participant getFeatureFlag as getFeatureFlag()<br/>Accessor
participant LegacyMap as FEATURE_FLAG_LEGACY_MAP
participant BlockProps as getFeatureFlags()<br/>(Block Props)
participant LegacyConfig as getFormattedConfigTree()<br/>(Legacy Config)
Component->>getFeatureFlag: getFeatureFlag(key)
getFeatureFlag->>LegacyMap: Check if legacy reader exists
alt Legacy reader found
LegacyMap-->>getFeatureFlag: Legacy reader fn
getFeatureFlag->>BlockProps: getFeatureFlags()
BlockProps-->>getFeatureFlag: blockPropsValue
alt New settings store enabled
getFeatureFlag->>LegacyConfig: Call legacy reader fn
LegacyConfig-->>getFeatureFlag: legacyValue
alt Values mismatch
getFeatureFlag->>getFeatureFlag: Log mismatch warning
end
getFeatureFlag-->>Component: Return blockPropsValue
else Legacy settings only
getFeatureFlag-->>Component: Return legacyValue
end
else No legacy reader
getFeatureFlag->>BlockProps: getFeatureFlags()
BlockProps-->>getFeatureFlag: value
getFeatureFlag-->>Component: Return value
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* ENG-1479: Port suggestive mode settings to dual-read Add dual-read routing to getFeatureFlag for flags with legacy counterparts. FEATURE_FLAG_LEGACY_MAP maps "Suggestive mode enabled" and "Enable left sidebar" to their config tree reads, gated by isNewSettingsStoreEnabled(). Flags without legacy entries go straight to block props (no behavior change). Migrate value reads from getFormattedConfigTree() / extensionAPI.settings to accessors: - index.ts: getUidAndBooleanSetting → getFeatureFlag (accessor handles legacy fallback now) - AdminPanel: suggestiveModeEnabled.value → getFeatureFlag in both FeatureFlagsTab and main component. Removed unused useMemo. - SuggestiveModeSettings: includePageRelations state init → getGlobalSetting. Dropped initialValue from both GlobalFlagPanels. - hyde.ts: orphan extensionAPI.settings.get() reads → getGlobalSetting. Fixes bug where sync config toggles had no runtime effect (keys were never written by any code). Structural UIDs remain with getFormattedConfigTree(). pageGroups.groups NOT migrated — type mismatch (legacy PageGroup has UIDs, Zod PageGroup does not). Deferred to ENG-1470. * Align hyde.ts fallback defaults with Zod schema * Fix eslint naming-convention warnings in FEATURE_FLAG_LEGACY_MAP * Add TODO(ENG-1484) for suggestive mode reactivity
https://www.loom.com/share/6b740485161741e8b5ddd7d58b5f9891
Summary by CodeRabbit