Skip to content

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Feb 12, 2026

https://www.loom.com/share/09868acba4424e28b0369c96104dbd3d


Open with Devin

Summary by CodeRabbit

  • Bug Fixes
    • Improved relation configuration saving with enhanced block structure and data persistence.
    • Fixed initialization flow to correctly map and reconcile relation keys during settings setup.
    • Enhanced configuration panel refresh to properly display saved relation settings.

@linear
Copy link

linear bot commented Feb 12, 2026

@supabase
Copy link

supabase bot commented Feb 12, 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 12, 2026 09:14
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 6 additional findings.

Open in Devin Review

@sid597
Copy link
Collaborator Author

sid597 commented Feb 12, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Modifies the Discourse relation configuration panel to support asynchronous block updates and saves computed relation data to global settings. Concurrently refactors initialization logic to reconcile placeholder relation keys with actual block UIDs and updates the block property accessor signature.

Changes

Cohort / File(s) Summary
Relation Config Panel
apps/roam/src/components/settings/DiscourseRelationConfigPanel.tsx
Restructures save flow to wrap state updates in async IIFE with setTimeout; rebuilds block construction logic to assemble "And" blocks with nested relation structures and node positions; introduces extraction and persistence of ifConditions and relation metadata to global settings via setGlobalSetting.
Settings Initialization & Reconciliation
apps/roam/src/components/settings/utils/init.ts
Introduces new reconcileRelationKeys function to map placeholder relation keys to actual block UIDs discovered in grammar/relations blocks; updates initializeSettingsBlockProps signature to accept pageUid parameter; extends initialization flow to invoke reconciliation logic for global relations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • PR #669: Modifies relations defaults/schema and block-prop accessors within settings plumbing, with direct usage in the init.ts changes and setGlobalSetting calls in the component.
  • PR #666: Changes settings initialization logic in init.ts including initializeSettingsBlockProps flow and global relation key handling, overlapping with the reconciliation refactoring in this PR.
🚥 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 'ENG-1290: Port discourse node config panel' directly reflects the main changes: porting/refactoring the DiscourseRelationConfigPanel component with new async state management and block structure logic.
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
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

🤖 Fix all issues with AI agents
In `@apps/roam/src/components/settings/DiscourseRelationConfigPanel.tsx`:
- Around line 572-712: Wrap the async IIFE passed to setTimeout in a
try/catch/finally: inside try keep the existing sequence (setInputSetting,
updateBlock, createBlock, saveCyToElementRef, deleteBlock/createBlock loops,
setGlobalSetting, back()); in catch log/report the error (e.g., console.error or
show a user-facing toast) so failures from deleteBlock/createBlock/etc. are
surfaced; in finally ensure UI state is restored (reset any loading flags like
setLoading(false) if used) and still call back() or otherwise enable navigation
so the user is not stuck; locate the IIFE around symbols setInputSetting,
deleteBlock, createBlock, setGlobalSetting, and back to apply the change.
🧹 Nitpick comments (1)
apps/roam/src/components/settings/DiscourseRelationConfigPanel.tsx (1)

576-596: Unawaited setInputSetting / updateBlock calls in an otherwise await-ed flow.

These calls are fire-and-forget while the rest of the save flow (lines 667–676) carefully awaits block mutations. If any of these writes fail silently or race with the createBlock at line 601 (which also targets rootUid), the saved state could be inconsistent. Consider awaiting them for predictable ordering, especially since you're already in an async context.

♻️ Suggested change
-                  setInputSetting({
+                  await setInputSetting({
                     blockUid: rootUid,
                     key: "source",
                     value: source,
                   });
-                  setInputSetting({
+                  await setInputSetting({
                     blockUid: rootUid,
                     key: "destination",
                     value: destination,
                     index: 1,
                   });
-                  setInputSetting({
+                  await setInputSetting({
                     blockUid: rootUid,
                     key: "complement",
                     value: complement,
                     index: 2,
                   });
-                  updateBlock({
+                  await updateBlock({
                     uid: rootUid,
                     text: label,
                   });

@sid597 sid597 force-pushed the eng-1290-port-discourse-node-config-panelsv0 branch from 42e81c7 to 4e3f7d6 Compare February 12, 2026 09:54
@sid597 sid597 requested review from mdroidian and removed request for mdroidian February 12, 2026 09:55
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