Skip to content

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Aug 25, 2025

https://www.loom.com/share/7803fae56fb142e4b65495ef9d2a9be2?sid=2b615b6d-dbe1-426a-a168-f196de29e4d1

Summary by CodeRabbit

  • New Features

    • Description field now supports multi-line input with a resizable text area for easier editing and readability.
  • Style

    • General tab layout updated to a vertical stack with improved spacing for clearer organization.
    • Description rendered in a labeled panel above Shortcut and Tag fields for a more logical flow.
    • Maintains existing behavior for Format, Shortcut, Tag, and Specification sections while improving overall UI consistency.

@linear
Copy link

linear bot commented Aug 25, 2025

@supabase
Copy link

supabase bot commented Aug 25, 2025

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 Aug 25, 2025

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

📝 Walkthrough

Walkthrough

Adds multi-line Description support in NodeConfig by introducing a ValidatedTextareaPanel with Blueprint TextArea, makes the debounced updater generic to handle inputs and textareas, updates state/handlers for Description, adjusts General tab layout to vertical, and ignores Promise results from Roam write calls.

Changes

Cohort / File(s) Summary
Settings UI: Description to textarea, layout tweaks
apps/roam/src/components/settings/NodeConfig.tsx
- Introduces ValidatedTextareaPanel using Blueprint TextArea (minHeight 80, resizable, full-width).
- Replaces single-line Description with multi-line textarea and dedicated debounced state/handlers.
- Makes useDebouncedRoamUpdater generic for HTMLInputElement/HTMLTextAreaElement and updates handlers accordingly.
- Wraps Roam updateBlock/createBlock calls with void to ignore Promise results.
- General tab switches to vertical flex with gaps; Shortcut and Tag remain, wired to generic updater.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

🧹 Nitpick comments (5)
apps/roam/src/components/settings/NodeConfig.tsx (5)

60-90: ValidatedTextareaPanel: solid extraction; consider using Blueprint’s fill/rows for consistency.

Minor UI nit: prefer native Blueprint props for sizing to stay visually consistent with other controls.

Apply this tweak:

       <TextArea
         value={value}
         onChange={onChange}
         onBlur={onBlur}
         placeholder={placeholder}
-        className="w-full"
-        style={{ minHeight: 80, resize: "vertical" }}
+        className="w-full"
+        fill
+        rows={4}
+        style={{ resize: "vertical" }}
       />

103-124: Debounce timer needs unmount cleanup and value re-sync when uid/initialValue changes.

  • Without clearing the pending timeout on unmount, a write can fire after the component is gone.
  • Local state never re-syncs if a different node/uid is loaded into the same mounted component.

Both are easy, low-risk fixes.

   const isValidRef = useRef(isValid);
   isValidRef.current = isValid;
 
+  // Cleanup pending writes on unmount
+  useEffect(() => {
+    return () => window.clearTimeout(debounceRef.current);
+  }, []);
+
+  // Keep local state in sync when switching nodes/values
+  useEffect(() => {
+    setValue(initialValue);
+  }, [uid, initialValue]);

111-118: Confirm single-child semantics before overwriting only the first child.

You read the first child under the config parent (getBasicTreeByParentUid(uid)[0]) and update/create just that node. If more than one child exists (e.g., manual edits), this will ignore others and could surprise users. If the intended model is “exactly one child holds the value,” consider guarding or normalizing.

I can help harden this by pruning extra children or by selecting a child by a recognizable marker.


114-118: Avoid unhandled promise rejections for write calls.

Using void ignores the result but does not prevent unhandled rejections if the write fails (network, permissions). Chain a no-op catch (or a logger) to keep the “fire-and-forget” behavior without noisy errors.

-              void updateBlock({ uid: existingBlock.uid, text });
+              updateBlock({ uid: existingBlock.uid, text }).catch(() => { /* intentionally ignored */ });
@@
-            void createBlock({ parentUid: uid, node: { text } });
+            createBlock({ parentUid: uid, node: { text } }).catch(() => { /* intentionally ignored */ });

178-183: Blur handlers may write before validation settles (0ms timeout race).

handleTagBlur/handleFormatBlur call the hook’s blur first (which schedules an immediate write), then run validate(). Because validation updates isValid via state, the 0ms write can read the previous isValidRef and persist an invalid value.

Reorder to validate first; then trigger the blur write. Low-risk, improves correctness.

   const handleTagBlur = useCallback(() => {
-    handleTagBlurFromHook();
-    validate(tagValue, formatValue);
+    validate(tagValue, formatValue);
+    handleTagBlurFromHook();
   }, [handleTagBlurFromHook, tagValue, formatValue, validate]);
 
   const handleFormatBlur = useCallback(() => {
-    handleFormatBlurFromHook();
-    validate(tagValue, formatValue);
+    validate(tagValue, formatValue);
+    handleFormatBlurFromHook();
   }, [handleFormatBlurFromHook, tagValue, formatValue, validate]);

If you prefer to keep the current order, add a tiny timeout to the blur path (e.g., timeout 10–20ms) so the validation render updates isValidRef before the save callback fires.

Also applies to: 187-191

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6c63455 and 479e1fc.

📒 Files selected for processing (1)
  • apps/roam/src/components/settings/NodeConfig.tsx (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-19T22:34:23.619Z
Learnt from: CR
PR: DiscourseGraphs/discourse-graph#0
File: .cursor/rules/roam.mdc:0-0
Timestamp: 2025-07-19T22:34:23.619Z
Learning: Applies to apps/roam/**/*.{js,jsx,ts,tsx} : Use BlueprintJS 3 components and Tailwind CSS for platform-native UI in the Roam Research extension

Applied to files:

  • apps/roam/src/components/settings/NodeConfig.tsx
🔇 Additional comments (5)
apps/roam/src/components/settings/NodeConfig.tsx (5)

9-16: Imports look good; BP v3 TextArea addition aligns with our UI stack.

Using TextArea from @blueprintjs/core matches the retrieved learning to use BlueprintJS 3 + Tailwind. No issues spotted.


91-97: Good call making useDebouncedRoamUpdater generic.

The <T,> disambiguation in TSX is correct; this unlocks reuse for inputs and textareas without any any-casting.


127-133: Typed change handler looks correct.

React.ChangeEvent with the generic element keeps consumers type-safe. No action needed.


192-200: Description uses the new textarea updater correctly.

Passing true for isValid is fine given no validation rules for Description. Looks good.


265-291: General tab layout and Description UX are improvements.

Vertical stack with the textarea first reads well. No functional issues spotted.

@sid597 sid597 requested a review from mdroidian September 1, 2025 07:54
);

const useDebouncedRoamUpdater = (
const ValidatedTextareaPanel = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

How is it "validated"? Or why is this called "Validated..."?

@mdroidian mdroidian merged commit 9244798 into main Sep 6, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this to Done in General Sep 6, 2025
@mdroidian mdroidian deleted the eng-738-update-general-tab-description-vertical branch September 6, 2025 22:48
trangdoan982 pushed a commit that referenced this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants