ENG-1465: Enable dual read feature flag#811
ENG-1465: Enable dual read feature flag#811sid597 wants to merge 2 commits intoeng-1217-section-components-in-left-sidebarv2from
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThis PR introduces the "Enable dual read" feature flag with supporting infrastructure across multiple modules. The changes add UI rendering in AdminPanel, define the schema field, create an accessor utility, wire a feature flag handler with logging, and update the initialization flow to set up and tear down pull-watchers on application load/unload. Changes
Sequence DiagramsequenceDiagram
participant App as Application<br/>(index.ts)
participant Schema as Settings Schema<br/>(initSchema)
participant Watchers as Pull-Watchers<br/>(setupPullWatchOnSettingsPage)
participant Handlers as Flag Handlers<br/>(featureFlagHandlers)
participant UI as AdminPanel<br/>(FeatureFlagPanel)
App->>Schema: initSchema()
Schema-->>App: return { blockUids, ... }
App->>Watchers: setupPullWatchOnSettingsPage(blockUids)
Watchers->>Watchers: register handlers for feature flags
Watchers-->>App: return cleanup function
Note over UI: User toggles "Enable dual read"
UI->>Handlers: Feature flag value changes
Handlers->>Handlers: Execute "Enable dual read" handler
Handlers->>Handlers: Console log transition (newValue, oldValue)
Note over App: Application unload
App->>App: cleanupPullWatchers()
App->>Watchers: Execute cleanup function
Watchers->>Watchers: Unregister watchers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
d88de41 to
1d2ba62
Compare
3f08f30 to
0006f4d
Compare
| <FeatureFlagPanel | ||
| title="Enable dual read" | ||
| description="When enabled, accessor getters read from block props instead of the old system. Surfaces dual-write gaps during development." | ||
| featureKey="Enable dual read" | ||
| /> |
There was a problem hiding this comment.
🟡 FeatureFlagPanel missing initialValue causes checkbox to always render unchecked
The new FeatureFlagPanel for "Enable dual read" in AdminPanel does not pass initialValue, so the checkbox always starts as unchecked regardless of the persisted feature flag state.
Root Cause
The BaseFlagPanel component initializes its internal state with initialValue ?? false (BlockPropSettingPanels.tsx:177-178). Since initialValue is not provided by the caller at AdminPanel.tsx:471-475, the checkbox always renders as unchecked.
The existing FeatureFlagPanel usage in GeneralSettings.tsx:43-47 correctly passes initialValue={settings.leftSidebarEnabled.value} to reflect the persisted state. The new usage should similarly read the stored value, e.g. via getFeatureFlag("Enable dual read") from accessors.ts:283-286.
Impact: If a user enables "Enable dual read", navigates away from the Admin Panel, and returns, the toggle will incorrectly show as unchecked even though the feature is still enabled. Toggling it again would be a no-op or cause confusion about the actual state.
Prompt for agents
In apps/roam/src/components/settings/AdminPanel.tsx, at lines 471-475, the FeatureFlagPanel for "Enable dual read" needs an initialValue prop to reflect the persisted state. Import getFeatureFlag from ~/components/settings/utils/accessors (it's already available in the file's scope since setFeatureFlag is imported from the same module). Then pass initialValue={getFeatureFlag("Enable dual read")} to the FeatureFlagPanel. Note that this should be computed inside the component, ideally via useMemo or during the initial render, similar to how GeneralSettings.tsx:46 passes initialValue={settings.leftSidebarEnabled.value}. You may need to add getFeatureFlag to the existing import statement on line 41.
Was this helpful? React with 👍 or 👎 to provide feedback.
1d2ba62 to
4634da5
Compare
23d75a0 to
9dddded
Compare
1b440fb to
586c385
Compare
9dddded to
41691df
Compare
41691df to
176d0d1
Compare
2f1d7d7 to
a8420de
Compare
176d0d1 to
86bbad9
Compare
a8420de to
307dd54
Compare
9ab2003 to
64767b4
Compare
307dd54 to
5bcf109
Compare
64767b4 to
fbc154f
Compare
5bcf109 to
a679322
Compare
fbc154f to
ace46c2
Compare
a679322 to
79d4150
Compare

ENG-1454: Enable dual read feature flag
add caller
Summary by CodeRabbit
New Features
Chores