ENG-1472: Refactor BlockPropSettingPanels to add accessor-backed default reads#813
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. |
📝 WalkthroughWalkthroughThis PR refactors BlockPropSettingPanels.tsx to introduce a Changes
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. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx (1)
473-483: Consider logging caught errors for debuggability.The bare
catchsilently swallows all exceptions — including unexpected ones (e.g.,TypeErrorfrom a bug inreadPathValue). This is a reasonable resilience trade-off for UI code, but aconsole.warnwould 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.
5a02381 to
b67fd5f
Compare
c635833 to
b1ace1a
Compare
adf5fb5 to
75d22ad
Compare
c90e2c8 to
3b1643c
Compare
75d22ad to
cc8a3f2
Compare
cc8a3f2 to
c7a64a1
Compare
3b1643c to
ee38a5f
Compare
ee38a5f to
c7c04c6
Compare
0cf1a61 to
d604e8d
Compare
c7c04c6 to
2f2cf80
Compare
080ebb1 to
f1855a5
Compare
05be2a5 to
eb0ad72
Compare
5af843f to
dd836c8
Compare
53c9a33 to
95799e5
Compare
838709c to
bcc0697
Compare
95799e5 to
9c57cc9
Compare
bcc0697 to
9d90ba0
Compare
9c57cc9 to
e5f4075
Compare
feb69cc to
aac3698
Compare
9d90ba0 to
8d0b340
Compare
aac3698 to
847359f
Compare
8d0b340 to
b601efa
Compare
b601efa to
f8c803d
Compare
…ult reads (with initialValue fallback)
f8c803d to
fe4caa1
Compare

https://www.loom.com/share/1aaa5bcdb1344013af27c045e1f84b2c
Summary by CodeRabbit