ENG-949: Add query sections to left sidebar#1056
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b645caa0f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
📝 WalkthroughWalkthroughThis PR extends the left sidebar to support query-block sections as a new section type. Query sections run Roam queries and display results, with customizable alias names and result limits that persist to Roam blocks. The implementation adds schema fields, parsing utilities, a settings UI for configuration, and a new QuerySectionItem component for rendering. ChangesQuery-block sidebar sections
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/roam/src/components/settings/LeftSidebarPersonalSettings.tsx`:
- Around line 348-394: The debounce timeout set in handleAliasChange via
aliasUpdateTimeoutRef can fire after the component unmounts; add a cleanup
effect that clears aliasUpdateTimeoutRef.current on unmount to prevent stale
writes. Implement a useEffect with no dependencies (or appropriate lifecycle)
that returns a cleanup function calling
clearTimeout(aliasUpdateTimeoutRef.current) and nulling
aliasUpdateTimeoutRef.current, ensuring handleAliasChange, aliasUpdateTimeoutRef
and any created timeouts are cancelled when the component unmounts.
- Around line 742-753: The default for the new query section "Result-limit" is
inconsistent: the node initialization sets the child text to "10" while the
newSection.settings.resultLimit.value is 10, but the schema/default snapshots
expect 0 (unlimited). Update both the block node initialization (the child text
under node: { text: "Result-limit", children: [...] }) and the
newSection.settings.resultLimit.value (where resultLimit is created with uid:
resultLimitUid) to use 0 so the created section matches the schema/default
snapshots.
In `@apps/roam/src/components/settings/utils/zodSchema.ts`:
- Line 225: The "Result-limit" schema currently uses z.number().default(0) which
permits negative and fractional values; update the Zod schema for the
"Result-limit" field to require a non-negative integer (use Zod integer +
minimum zero validation) while preserving the default of 0 so runtime slicing
cannot receive negatives or decimals.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7a813ba3-f8cb-4ddd-b71b-630631050145
📒 Files selected for processing (7)
apps/roam/src/components/LeftSidebarView.tsxapps/roam/src/components/settings/LeftSidebarPersonalSettings.tsxapps/roam/src/components/settings/utils/accessors.tsapps/roam/src/components/settings/utils/zodSchema.example.tsapps/roam/src/components/settings/utils/zodSchema.tsapps/roam/src/utils/getExportSettings.tsapps/roam/src/utils/getLeftSidebarSettings.ts
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c5f06fd90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
https://www.loom.com/share/bc4e7221aa9240ec9f58a9ba3f5657ab
Summary by CodeRabbit