Skip to content

Comments

ENG-1280: Port Discourse node: Query builder and editor component for block props#764

Merged
sid597 merged 3 commits intoeng-1225-discourse-node-migrate-settings-prodfrom
eng-1280-discourse-node-query-builder-and-specification-setting-v2
Feb 23, 2026
Merged

ENG-1280: Port Discourse node: Query builder and editor component for block props#764
sid597 merged 3 commits intoeng-1225-discourse-node-migrate-settings-prodfrom
eng-1280-discourse-node-query-builder-and-specification-setting-v2

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Feb 11, 2026

https://www.loom.com/share/92b399a36f4d4e3f8e49a95e5c65661b


Open with Devin

Summary by CodeRabbit

  • New Features
    • Added automatic query state synchronization to discourse nodes, preserving query configurations and selections.
    • Introduced a new "custom" field to query settings for extended configuration options.
    • Enhanced query builder to support discourse node type associations.

@linear
Copy link

linear bot commented Feb 11, 2026

@supabase
Copy link

supabase bot commented Feb 11, 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 11, 2026 08:06
@sid597 sid597 changed the title query builder port Port Discourse node: Query builder and editor component for block props Feb 11, 2026
@sid597 sid597 changed the title Port Discourse node: Query builder and editor component for block props ENG-1280: Port Discourse node: Query builder and editor component for block props Feb 11, 2026
graphite-app[bot]

This comment was marked as resolved.

@sid597
Copy link
Collaborator Author

sid597 commented Feb 11, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 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 5 additional findings.

Open in Devin Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

The changes implement synchronization of query builder state to discourse node block properties. A new optional discourseNodeType prop is threaded through QueryBuilder and QueryEditor components. When provided, QueryEditor syncs the query state (conditions, selections, custom) to the discourse node using setDiscourseNodeSetting. The DiscourseNodeIndex initializes index settings on block creation and passes the node type to enable this synchronization behavior.

Changes

Cohort / File(s) Summary
Query Component Props & Synchronization
apps/roam/src/components/QueryBuilder.tsx, apps/roam/src/components/QueryEditor.tsx
Added optional discourseNodeType prop to both components. QueryEditor implements new effect that syncs query state (conditions, selections, custom) to discourse node via setDiscourseNodeSetting with validation and debouncing when discourseNodeType is provided.
Index Initialization
apps/roam/src/components/settings/DiscourseNodeIndex.tsx
Initializes index settings with default conditions and empty selections when creating a new block. Passes discourseNodeType to QueryBuilder to enable synchronization.
Schema Extensions
apps/roam/src/components/settings/utils/zodSchema.ts, apps/roam/src/components/settings/utils/zodSchema.example.ts
Extended IndexSchema to include new custom field with string type and empty string default.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QueryEditor
    participant DebounceTimer
    participant IndexSchema
    participant DiscourseNode

    User->>QueryEditor: Update conditions/selections/custom
    QueryEditor->>DebounceTimer: Clear previous timeout
    DebounceTimer->>DebounceTimer: Start new 500ms timer
    
    DebounceTimer->>IndexSchema: Validate query state
    IndexSchema-->>IndexSchema: safeParse(data)
    
    alt Validation succeeds
        IndexSchema-->>QueryEditor: Valid data
        QueryEditor->>DiscourseNode: setDiscourseNodeSetting("index", validatedData)
        DiscourseNode-->>QueryEditor: Updated
    else Validation fails
        IndexSchema-->>QueryEditor: Parse error (silently ignored)
    end
Loading

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 clearly and specifically describes the main change: porting a Discourse node query builder and editor component to support block props synchronization.
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.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/roam/src/components/settings/DiscourseNodeIndex.tsx (1)

27-68: ⚠️ Potential issue | 🟠 Major

No error handling on the createBlock promise — spinner may hang indefinitely on failure.

If createBlock rejects, setShowQuery(true) is never called, leaving the user stuck on a <Spinner /> with no recovery path. Consider adding a .catch() to handle the failure gracefully.

Proposed fix
       void createBlock({
         parentUid: initialQueryArgs.conditionsNodesUid,
         node: {
           text: "clause",
           children: [
             {
               text: "source",
               children: [{ text: DEFAULT_RETURN_NODE }],
             },
             {
               text: "relation",
               children: [{ text: "is a" }],
             },
             {
               text: "target",
               children: [
                 {
                   text: node.text,
                 },
               ],
             },
           ],
         },
       }).then(() => {
         setDiscourseNodeSetting(node.type, ["index"], {
           conditions: [
             {
               type: "clause",
               source: DEFAULT_RETURN_NODE,
               relation: "is a",
               target: node.text,
             },
           ],
           selections: [],
         });
 
         setShowQuery(true);
-      });
+      }).catch((error) => {
+        console.error("Failed to create initial query block:", error);
+        setShowQuery(true);
+      });
🧹 Nitpick comments (1)
apps/roam/src/components/settings/DiscourseNodeIndex.tsx (1)

53-63: Minor inconsistency: initial index write omits custom field.

The IndexSchema now includes custom: z.string().default(""), and QueryEditor's sync logic serializes custom. This initial write to setDiscourseNodeSetting omits it. It works because Zod fills in the default on read, but adding custom: "" here would be consistent with the schema and the sync logic in QueryEditor.

Proposed fix
         setDiscourseNodeSetting(node.type, ["index"], {
           conditions: [
             {
               type: "clause",
               source: DEFAULT_RETURN_NODE,
               relation: "is a",
               target: node.text,
             },
           ],
           selections: [],
+          custom: "",
         });

devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 changed the base branch from eng-1225-discourse-node-migrate-settings-prod to graphite-base/764 February 15, 2026 18:23
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from 898a0bd to adab8d8 Compare February 15, 2026 18:24
@sid597 sid597 changed the base branch from graphite-base/764 to eng-1225-discourse-node-migrate-settings-prod February 15, 2026 18:24
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from adab8d8 to cc9fd40 Compare February 16, 2026 08:24
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from 3b51bcc to 23e6249 Compare February 16, 2026 08:25
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from cc9fd40 to 3be01d4 Compare February 17, 2026 05:16
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from 23e6249 to 2700c52 Compare February 17, 2026 05:16
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from 2700c52 to 7cd4348 Compare February 17, 2026 15:07
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from 3be01d4 to 72de51b Compare February 17, 2026 15:07
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from 7cd4348 to 70a27fd Compare February 17, 2026 15:37
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch 2 times, most recently from 28d44a4 to 5a3bbba Compare February 17, 2026 16:04
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from ed44054 to f2c0787 Compare February 23, 2026 05:11
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from 5a3bbba to 7eda278 Compare February 23, 2026 05:11
@sid597 sid597 force-pushed the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch from 7eda278 to ff23661 Compare February 23, 2026 06:10
@sid597 sid597 force-pushed the eng-1225-discourse-node-migrate-settings-prod branch from f2c0787 to 26971c9 Compare February 23, 2026 06:10
@sid597 sid597 merged commit 7d6f127 into eng-1225-discourse-node-migrate-settings-prod Feb 23, 2026
11 of 14 checks passed
@sid597 sid597 deleted the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch February 23, 2026 10:41
@sid597 sid597 restored the eng-1280-discourse-node-query-builder-and-specification-setting-v2 branch February 23, 2026 11:02
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