Skip to content

ENG-1472: Refactor BlockPropSettingPanels to add accessor-backed default reads#813

Open
sid597 wants to merge 2 commits intoeng-1455-add-old-system-read-routing-to-accessor-gettersfrom
eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed
Open

ENG-1472: Refactor BlockPropSettingPanels to add accessor-backed default reads#813
sid597 wants to merge 2 commits intoeng-1455-add-old-system-read-routing-to-accessor-gettersfrom
eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Feb 22, 2026

https://www.loom.com/share/1aaa5bcdb1344013af27c045e1f84b2c

main
    └── migration-block-init-staging-branch  (staging base)
         └── eng-1455 (#812)
              └── eng-1472  (this PR)

Open with Devin

Summary by CodeRabbit

  • Refactor
    • Improved settings initialization mechanism with enhanced fallback support across global, personal, and feature flag setting panels. Changes ensure more robust setting retrieval while maintaining existing component behavior.

@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
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 refactors BlockPropSettingPanels.tsx to introduce a readWithFallback helper and replaces direct initialValue usage with calls to setting accessor functions (getGlobalSetting, getPersonalSetting, getFeatureFlag, getDiscourseNodeSetting), each with a fallback to existing initialValues.

Changes

Cohort / File(s) Summary
BlockPropSettingPanels Refactoring
apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx
Introduces readWithFallback helper and updates Global, Personal, and DiscourseNode setting panels to resolve initial values via dedicated accessor functions with fallback support. Adds imports for getGlobalSetting, getPersonalSetting, getFeatureFlag, and getDiscourseNodeSetting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: refactoring BlockPropSettingPanels to add accessor-backed default reads with fallback logic.
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.

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 (1)
apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx (1)

473-483: Consider logging caught errors for debuggability.

The bare catch silently swallows all exceptions — including unexpected ones (e.g., TypeError from a bug in readPathValue). This is a reasonable resilience trade-off for UI code, but a console.warn would make misconfigured keys or accessor bugs much easier to diagnose.

Proposed fix
 const readWithFallback = <T,>(
   reader: () => T | undefined,
   fallback?: T,
 ): T | undefined => {
   try {
     const value = reader();
     return value ?? fallback;
-  } catch {
+  } catch (e) {
+    console.warn("[readWithFallback] accessor threw, using fallback:", e);
     return fallback;
   }
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx`
around lines 473 - 483, The readWithFallback function currently swallows all
exceptions silently; update it to catch the error into a variable and call
console.warn (or processLogger if available) with a concise message including
the error and context (e.g., "readWithFallback failed" and the thrown error)
before returning the fallback; keep existing behavior of returning fallback on
exceptions and preserve the reader/fallback signature so callers of
readWithFallback continue to work unchanged.
🤖 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/components/BlockPropSettingPanels.tsx`:
- Around line 473-483: The readWithFallback function currently swallows all
exceptions silently; update it to catch the error into a variable and call
console.warn (or processLogger if available) with a concise message including
the error and context (e.g., "readWithFallback failed" and the thrown error)
before returning the fallback; keep existing behavior of returning fallback on
exceptions and preserve the reader/fallback signature so callers of
readWithFallback continue to work unchanged.

@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from 5a02381 to b67fd5f Compare February 23, 2026 10:40
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch 2 times, most recently from c635833 to b1ace1a Compare February 23, 2026 13:51
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch 2 times, most recently from adf5fb5 to 75d22ad Compare February 23, 2026 14:13
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch 2 times, most recently from c90e2c8 to 3b1643c Compare February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from 75d22ad to cc8a3f2 Compare February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from cc8a3f2 to c7a64a1 Compare February 23, 2026 14:35
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from 3b1643c to ee38a5f Compare February 23, 2026 14:35
devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from ee38a5f to c7c04c6 Compare February 23, 2026 15:28
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch 2 times, most recently from 0cf1a61 to d604e8d Compare February 23, 2026 15:31
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from c7c04c6 to 2f2cf80 Compare February 23, 2026 15:31
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch 2 times, most recently from 080ebb1 to f1855a5 Compare February 23, 2026 17:53
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from 05be2a5 to eb0ad72 Compare February 24, 2026 05:46
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch 2 times, most recently from 5af843f to dd836c8 Compare February 24, 2026 05:48
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch 2 times, most recently from 53c9a33 to 95799e5 Compare February 24, 2026 06:16
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch 2 times, most recently from 838709c to bcc0697 Compare February 24, 2026 06:29
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from 95799e5 to 9c57cc9 Compare February 24, 2026 06:29
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from bcc0697 to 9d90ba0 Compare February 24, 2026 06:42
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from 9c57cc9 to e5f4075 Compare February 24, 2026 06:42
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch 5 times, most recently from feb69cc to aac3698 Compare February 25, 2026 07:44
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from 9d90ba0 to 8d0b340 Compare February 25, 2026 08:48
@sid597 sid597 force-pushed the eng-1455-add-old-system-read-routing-to-accessor-getters branch from aac3698 to 847359f Compare February 25, 2026 09:47
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from 8d0b340 to b601efa Compare February 25, 2026 10:25
devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from b601efa to f8c803d Compare February 25, 2026 11:45
@sid597 sid597 force-pushed the eng-1472-refactor-blockpropsettingpanels-to-add-accessor-backed branch from f8c803d to fe4caa1 Compare February 25, 2026 16:16
@sid597 sid597 changed the title ENG-1472: Refactor BlockPropSettingPanels to add accessor-backed default reads (with initialValue fallback) ENG-1472: Refactor BlockPropSettingPanels to add accessor-backed default reads Feb 25, 2026
@sid597 sid597 requested a review from mdroidian February 25, 2026 17:54
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