Skip to content

ENG-1465: Add "Use new settings store" feature flag #811

Merged
sid597 merged 6 commits intomigration-block-init-staging-branchfrom
eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor
Feb 25, 2026
Merged

ENG-1465: Add "Use new settings store" feature flag #811
sid597 merged 6 commits intomigration-block-init-staging-branchfrom
eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Feb 22, 2026

https://www.loom.com/share/ada47787b17b48c78d46ecbf1e44c0c6

add caller


Open with Devin

Summary by CodeRabbit

  • New Features
    • Added "Use new settings store" feature flag to the admin panel. When enabled, the settings system reads from block properties, surfacing any dual-write gaps during development.
    • Implemented change tracking infrastructure for the settings system.

@linear
Copy link

linear bot commented Feb 22, 2026

@supabase
Copy link

supabase bot commented Feb 22, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@sid597 sid597 marked this pull request as ready for review February 22, 2026 16:23
@sid597
Copy link
Collaborator Author

sid597 commented Feb 22, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new feature flag "Use new settings store" that enables reading accessor getters from block props instead of the old system. The flag is added to the schema, exposed in the admin UI, and the initialization flow is extended to set up pull-watchers on the settings page.

Changes

Cohort / File(s) Summary
Feature Flag Schema
apps/roam/src/components/settings/utils/zodSchema.ts, apps/roam/src/components/settings/utils/zodSchema.example.ts
Added a new boolean "Use new settings store" field with default false to FeatureFlagsSchema and example feature flag objects.
Admin UI & Accessors
apps/roam/src/components/settings/AdminPanel.tsx, apps/roam/src/components/settings/utils/accessors.ts
Rendered a FeatureFlagPanel in AdminPanel for the new "Use new settings store" flag and added a helper function isNewSettingsStoreEnabled() that wraps the feature flag accessor.
Initialization Setup
apps/roam/src/index.ts
Modified initSchema() to return blockUids and integrated setupPullWatchOnSettingsPage call with cleanup routine registration on unload.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a new feature flag called 'Use new settings store' which is the core modification across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 force-pushed the eng-1328-port-small-blueprint-based-misc-settings-into-props-based branch from 1d2ba62 to 4634da5 Compare February 23, 2026 10:40
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from 23d75a0 to 9dddded Compare February 23, 2026 13:51
@sid597 sid597 force-pushed the eng-1328-port-small-blueprint-based-misc-settings-into-props-based branch 2 times, most recently from 1b440fb to 586c385 Compare February 23, 2026 14:13
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 9dddded to 41691df Compare February 23, 2026 14:13
@sid597 sid597 changed the base branch from eng-1328-port-small-blueprint-based-misc-settings-into-props-based to graphite-base/811 February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 41691df to 176d0d1 Compare February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 176d0d1 to 86bbad9 Compare February 23, 2026 14:35
@sid597 sid597 changed the base branch from graphite-base/811 to eng-1217-section-components-in-left-sidebarv2 February 23, 2026 14:36
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from a8420de to 307dd54 Compare February 23, 2026 15:28
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from 9ab2003 to 64767b4 Compare February 23, 2026 15:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 97f27cd to 9d0b4f6 Compare February 24, 2026 05:48
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from f87715d to b18c761 Compare February 24, 2026 05:48
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from f81fbc0 to b34c8a3 Compare February 24, 2026 06:29
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from 081c714 to 57545ba Compare February 24, 2026 06:29
@sid597 sid597 changed the base branch from eng-1217-section-components-in-left-sidebarv2 to graphite-base/811 February 24, 2026 06:42
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from b34c8a3 to 22f4573 Compare February 24, 2026 06:42
@sid597 sid597 changed the base branch from graphite-base/811 to main February 24, 2026 06:42
devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 changed the base branch from main to migration-block-init-staging-branch February 24, 2026 10:05
@sid597 sid597 changed the title ENG-1465: Enable dual read feature flag ENG-1465: Add "Use new settings store" feature flag Feb 24, 2026
@sid597
Copy link
Collaborator Author

sid597 commented Feb 24, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/roam/src/components/settings/utils/accessors.ts (1)

288-291: Optional: simplify to expression body.

The function body is a single return statement; an expression arrow matches the style of getFeatureFlag directly above it.

♻️ Proposed simplification
-export const isNewSettingsStoreEnabled = (): boolean => {
-  return getFeatureFlag("Use new settings store");
-};
+export const isNewSettingsStoreEnabled = (): boolean =>
+  getFeatureFlag("Use new settings store");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/roam/src/components/settings/utils/accessors.ts` around lines 288 - 291,
The function isNewSettingsStoreEnabled has a single return statement; simplify
it to an expression-bodied arrow to match the surrounding style (like
getFeatureFlag) by replacing the block body with a concise expression returning
getFeatureFlag("Use new settings store"); keep the same function name
isNewSettingsStoreEnabled and behavior.
apps/roam/src/components/settings/AdminPanel.tsx (1)

468-473: getFeatureFlag called at render time causes unnecessary Roam API calls; confirm need for memoization.

getFeatureFlag("Use new settings store") is evaluated on every re-render of FeatureFlagsTab (triggered by state changes like isAlertOpen, isInstructionOpen), which invokes getBlockUidByTextOnPage and getBlockProps each time. While BaseFlagPanel correctly uses useState(() => initialValue ?? false) to initialize state only once, re-computing the initial value on every parent render is wasteful and causes unnecessary Roam API calls.

The RoamBlockSyncProps fields (parentUid, uid, order) are all optional and do not need to be passed here.

♻️ Optional refactor to memoize the feature flag value
 const FeatureFlagsTab = (): React.ReactElement => {
   ...
+  const [isNewSettingsStoreEnabled] = useState(() =>
+    getFeatureFlag("Use new settings store"),
+  );
   ...
       <FeatureFlagPanel
         title="Use new settings store"
         description="When enabled, accessor getters read from block props instead of the old system. Surfaces dual-write gaps during development."
         featureKey="Use new settings store"
-        initialValue={getFeatureFlag("Use new settings store")}
+        initialValue={isNewSettingsStoreEnabled}
       />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/roam/src/components/settings/AdminPanel.tsx` around lines 468 - 473, The
call to getFeatureFlag("Use new settings store") in FeatureFlagsTab causes Roam
API calls on every render; change FeatureFlagPanel usage so the initialValue is
memoized or computed once (e.g., compute value with useMemo or initialize a
local state once) and pass that memoized/initialized boolean to FeatureFlagPanel
instead of calling getFeatureFlag directly during render. Locate FeatureFlagsTab
and replace the direct getFeatureFlag(...) call with a stable value (memoized or
via useState(() => getFeatureFlag(...))) so BaseFlagPanel’s useState(() =>
initialValue ?? false) only runs once; also remove the unnecessary optional
RoamBlockSyncProps (parentUid, uid, order) from the props passed to
FeatureFlagPanel.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/roam/src/components/settings/AdminPanel.tsx`:
- Around line 468-473: The call to getFeatureFlag("Use new settings store") in
FeatureFlagsTab causes Roam API calls on every render; change FeatureFlagPanel
usage so the initialValue is memoized or computed once (e.g., compute value with
useMemo or initialize a local state once) and pass that memoized/initialized
boolean to FeatureFlagPanel instead of calling getFeatureFlag directly during
render. Locate FeatureFlagsTab and replace the direct getFeatureFlag(...) call
with a stable value (memoized or via useState(() => getFeatureFlag(...))) so
BaseFlagPanel’s useState(() => initialValue ?? false) only runs once; also
remove the unnecessary optional RoamBlockSyncProps (parentUid, uid, order) from
the props passed to FeatureFlagPanel.

In `@apps/roam/src/components/settings/utils/accessors.ts`:
- Around line 288-291: The function isNewSettingsStoreEnabled has a single
return statement; simplify it to an expression-bodied arrow to match the
surrounding style (like getFeatureFlag) by replacing the block body with a
concise expression returning getFeatureFlag("Use new settings store"); keep the
same function name isNewSettingsStoreEnabled and behavior.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a44f91 and 2b16770.

📒 Files selected for processing (5)
  • apps/roam/src/components/settings/AdminPanel.tsx
  • apps/roam/src/components/settings/utils/accessors.ts
  • apps/roam/src/components/settings/utils/zodSchema.example.ts
  • apps/roam/src/components/settings/utils/zodSchema.ts
  • apps/roam/src/index.ts

@sid597 sid597 requested a review from mdroidian February 24, 2026 12:24
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from 0ff501b to 017e4da Compare February 24, 2026 17:15
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 017e4da to 990543f Compare February 24, 2026 19:07
@sid597 sid597 force-pushed the migration-block-init-staging-branch branch from 3ad8656 to 4f5eb59 Compare February 25, 2026 07:32
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 990543f to 1491bbf Compare February 25, 2026 07:34
@sid597 sid597 merged commit 5d383e3 into migration-block-init-staging-branch Feb 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants