Skip to content

Conversation

@mdroidian
Copy link
Collaborator

@mdroidian mdroidian commented Jan 7, 2026

image

Summary by CodeRabbit

  • Breaking Changes

    • Several UI rendering APIs are now asynchronous and return Promises. Integrations must handle asynchronous results.
  • New Features

    • Added a new API to render raw strings into the UI.
    • Unmounting/render cleanup is now asynchronous, improving teardown reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Walkthrough

The PR updates TypeScript declarations in src/types/index.ts: renderBlock, renderPage, and renderSearch now return Promise instead of null; renderString and unmountNode methods are added returning Promise; argument shapes are unchanged. package.json version is bumped from 0.85.7 to 0.86.0. No other public API shapes were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Update roamAlphaAPI types #45 — Modifies UI components type declarations related to renderBlock/renderPage/renderSearch and unmountNode; strongly related to the async/type changes in this PR.

Suggested labels

codex

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title refers to renderString, but the PR also makes significant async changes to renderBlock, renderPage, renderSearch, and unmountNode signatures. Consider revising the title to be more comprehensive, such as 'Make UI component render methods async' or 'Update UI component type signatures to return Promises'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✨ Finishing touches
  • 📝 Generate docstrings

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

@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 @src/types/index.ts:
- Around line 274-277: The type for renderString is inconsistent with its
siblings: change the signature of renderString from returning Promise<null> to
returning null (i.e., renderString: (args: { string: string; el: HTMLElement; })
=> null) to match renderBlock, renderPage, and renderSearch unless you
intentionally require async behavior—if async is required, update the other
render* signatures and add a comment documenting that renderString is
intentionally async to reflect the external Roam Alpha API.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be5d99d and e6f8e59.

📒 Files selected for processing (1)
  • src/types/index.ts

@mdroidian mdroidian merged commit 42644dc into main Jan 7, 2026
1 of 2 checks passed
@mdroidian mdroidian deleted the add-ui-components-renderString branch January 7, 2026 21:05
Copy link

@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: 2

🤖 Fix all issues with AI agents
In @src/types/index.ts:
- Around line 266-273: The renderSearch type is asynchronous (returns
Promise<null>) but callers may not realize they must await it; update the type
declaration for renderSearch and its public API docs by adding a concise
JSDoc/typed comment on the renderSearch signature indicating it must be awaited
(or chained with .then()) and what the resolved value represents, and consider
changing Promise<null> to Promise<void> for clarity (update any call sites/tests
that assume synchronous behavior). Ensure you reference the renderSearch
function in the types and runtime docs so external consumers know to await its
completion.
- Around line 261-265: The createPage then-callback calls
window.roamAlphaAPI.ui.components.renderPage(...) but does not await its
now-Promise-returning signature; make the then callback async (or use an async
function) and await renderPage (window.roamAlphaAPI.ui.components.renderPage({
uid: parentUid, el, "hide-mentions?": true })) before calling if (autoFocus)
realFocus(); update FormDialog.tsx so renderPage is awaited to ensure
realFocus() runs after rendering completes.
🧹 Nitpick comments (2)
src/types/index.ts (2)

274-277: Consistency achieved; past review concern resolved.

The previous review flagged renderString as inconsistent because it returned Promise<null> while renderBlock, renderPage, and renderSearch returned null (sync). Now all render methods consistently return Promise<null>, which resolves that concern.

However, consider using Promise<void> instead of Promise<null> to align with TypeScript conventions for async operations without meaningful return values.

📝 Suggested refactor for idiomatic TypeScript

Apply this pattern to all render methods (renderBlock, renderPage, renderSearch, renderString):

-          renderString: (args: {
-            string: string;
-            el: HTMLElement;
-          }) => Promise<null>;
+          renderString: (args: {
+            string: string;
+            el: HTMLElement;
+          }) => Promise<void>;

278-278: New unmountNode method looks appropriate.

The signature is reasonable for an unmount operation. As with the render methods, consider using Promise<void> instead of Promise<null> for consistency with TypeScript conventions.

📝 Suggested refactor
-          unmountNode: (args: { el: HTMLElement }) => Promise<null>;
+          unmountNode: (args: { el: HTMLElement }) => Promise<void>;
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6f8e59 and ff23ea7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/types/index.ts
✅ Files skipped from review due to trivial changes (1)
  • package.json
🔇 Additional comments (1)
src/types/index.ts (1)

255-260: Return type is correct; do not change to Promise<void>.

The current Promise<null> return type matches the actual Roam Alpha API behavior, as empirically verified against the live API. Changing this to Promise<void> would create a type mismatch with reality and should not be done.

While the shift to async methods (if previously sync) is a breaking change for external consumers, the type definitions are accurate as-is.

Likely an incorrect or invalid review comment.

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