Skip to content

ENG-1573: Merge sync functionality to both Duplicate node alert and suggestive mode checkboxes in admin panel.#929

Open
sid597 wants to merge 1 commit intomainfrom
eng-1573-separate-sync-mode-flagtoggle-from-suggestive-mode
Open

ENG-1573: Merge sync functionality to both Duplicate node alert and suggestive mode checkboxes in admin panel.#929
sid597 wants to merge 1 commit intomainfrom
eng-1573-separate-sync-mode-flagtoggle-from-suggestive-mode

Conversation

@sid597
Copy link
Copy Markdown
Collaborator

@sid597 sid597 commented Mar 30, 2026


Open with Devin

Summary by CodeRabbit

Release Notes

  • Refactor
    • Redesigned feature flag controls in the admin settings panel with improved two-step consent and instruction workflows.
    • Relocated suggestive mode overlay setting from personal settings to the global feature flags system.
    • Streamlined access to duplicate node alert and suggestive mode overlay configuration.

@linear
Copy link
Copy Markdown

linear bot commented Mar 30, 2026

@supabase
Copy link
Copy Markdown

supabase bot commented Mar 30, 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
Copy link
Copy Markdown
Collaborator Author

sid597 commented Mar 30, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

This PR refactors feature flag management by replacing config-tree-based settings with feature-flag-driven controls. The "Suggestive mode enabled" setting is renamed to "Suggestive mode overlay enabled" in the feature flags schema, while being removed from personal settings. A new isSyncEnabled() accessor consolidates sync initialization logic, and FeatureFlagPanel gains controlled-state support via an optional value prop.

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
Renamed "Suggestive mode enabled" to "Suggestive mode overlay enabled" in FeatureFlagsSchema; removed "Suggestive mode overlay" from PersonalSettingsSchema.
Feature Flag Accessor
apps/roam/src/components/settings/utils/accessors.ts
Added new exported isSyncEnabled() helper that ORs the two feature flags ("Duplicate node alert enabled" and "Suggestive mode overlay enabled").
Component API Update
apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx
Added optional value?: boolean prop to FeatureFlagPanel for externally controlled checkbox state.
Settings UI Refactoring
apps/roam/src/components/settings/AdminPanel.tsx
Refactored feature flag UI from inline checkbox/block create/delete flows into FeatureFlagPanel instances with callback-based consent/instruction alerts; removed useMemo-computed config tree.
Settings UI Simplification
apps/roam/src/components/settings/HomePersonalSettings.tsx, apps/roam/src/components/settings/NodeConfig.tsx
Removed suggestive-mode overlay settings UI and per-component settings initialization; replaced conditional rendering from settings.suggestiveModeEnabled.value to isSyncEnabled().
Configuration Tree Cleanup
apps/roam/src/utils/discourseConfigRef.ts
Removed suggestiveModeEnabled: BooleanSetting field from FormattedConfigTree type.
Initialization Logic
apps/roam/src/index.ts, apps/roam/src/utils/initializeObserversAndListeners.ts
Replaced per-page config-tree-based sync gate with isSyncEnabled() feature-flag check; removed "(BETA) Suggestive Mode Enabled" setting computation; switched suggestive overlay observer activation from per-setting read to feature-flag lookup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: moving sync functionality controls into both 'Duplicate node alert' and 'suggestive mode' checkbox controls in the admin panel, which is consistent with the refactored FeatureFlagPanel architecture.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

Copy link
Copy Markdown
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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/roam/src/components/settings/AdminPanel.tsx`:
- Around line 283-291: handleFeatureToggled currently only opens the
reload/instruction alert when enabling (checked === true); change it to open the
alert for both enable and disable by calling setIsInstructionAlertOpen(true)
after calling setter(checked) (i.e., remove the checked-only condition), and
update the instruction alert text/state (used where setIsInstructionAlertOpen is
read) to a generic message that applies to both enabling and disabling so users
are prompted to reload when the observer change requires it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0aa385e-cb8f-43b7-9631-0872c82917f7

📥 Commits

Reviewing files that changed from the base of the PR and between 69bf42c and 6c71d26.

📒 Files selected for processing (10)
  • apps/roam/src/components/settings/AdminPanel.tsx
  • apps/roam/src/components/settings/HomePersonalSettings.tsx
  • apps/roam/src/components/settings/NodeConfig.tsx
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.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
  • apps/roam/src/utils/discourseConfigRef.ts
  • apps/roam/src/utils/initializeObserversAndListeners.ts
💤 Files with no reviewable changes (1)
  • apps/roam/src/utils/discourseConfigRef.ts

Comment on lines +283 to +291
const handleFeatureToggled = (
checked: boolean,
setter: (v: boolean) => void,
) => {
setter(checked);
if (checked) {
setIsInstructionAlertOpen(true);
}
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider prompting for reload when disabling features too.

The reload prompt is only shown when checked is true (enabling). However, based on the initialization logic in initializeObserversAndListeners.ts, disabling a feature flag also requires a reload to take effect—the observer registered at startup will remain active until the page reloads.

Users might disable the feature expecting an immediate effect, but the observer will persist.

💡 Suggested fix
 const handleFeatureToggled = (
   checked: boolean,
   setter: (v: boolean) => void,
 ) => {
   setter(checked);
-  if (checked) {
-    setIsInstructionAlertOpen(true);
-  }
+  setIsInstructionAlertOpen(true);
 };

Then update the instruction alert message to be more generic (applicable for both enable/disable):

-<p>Please reload the graph for this change to take effect.</p>
+<p>Please reload the graph for this setting change to take effect.</p>
🤖 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 283 - 291,
handleFeatureToggled currently only opens the reload/instruction alert when
enabling (checked === true); change it to open the alert for both enable and
disable by calling setIsInstructionAlertOpen(true) after calling setter(checked)
(i.e., remove the checked-only condition), and update the instruction alert
text/state (used where setIsInstructionAlertOpen is read) to a generic message
that applies to both enabling and disabling so users are prompted to reload when
the observer change requires it.

Copy link
Copy Markdown
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 5 additional findings.

Open in Devin Review

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.

1 participant