Repository navigation
Initialize notebooks store - #48801
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR adds notebook domain types, Valtio state management, notebook tabs, Explorer notebook creation, nested Explorer routes, and a placeholder notebook editor. It also adds state and editor tests. ChangesNotebook flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant NewTabButton
participant useCreateNotebook
participant notebooksState
participant ExplorerRoute
participant NotebookEditor
NewTabButton->>useCreateNotebook: createNotebook()
useCreateNotebook->>notebooksState: addNotebook() and addNeedsSaving()
useCreateNotebook->>ExplorerRoute: navigate to notebook route
ExplorerRoute->>NotebookEditor: render notebook route
NotebookEditor->>notebooksState: read notebook state and register notebook tab
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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: 2
🧹 Nitpick comments (1)
apps/studio/state/tabs.tsx (1)
643-644: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the notebook parameter variant.
Line 644 asserts
paramsasCreateTabIdParams['sql']in thenotebookbranch. This works only because both variants currently contain a stringid. UseCreateTabIdParams['notebook']so future notebook-specific parameters remain type-checked.Proposed fix
case 'notebook': - return `notebook-${(params as CreateTabIdParams['sql']).id}` + return `notebook-${(params as CreateTabIdParams['notebook']).id}`🤖 Prompt for 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. In `@apps/studio/state/tabs.tsx` around lines 643 - 644, Update the `notebook` case in the tab ID generation logic to cast `params` as `CreateTabIdParams['notebook']` instead of the SQL variant, while preserving the existing notebook ID format.Source: Coding guidelines
🤖 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/studio/components/interfaces/Explorer/hooks.ts`:
- Around line 15-17: Update createNotebook so missing profile or project
prerequisites produce a user-visible failure via sonner’s toast.error instead of
only console.error; preserve the early return and provide a clear message
identifying the unavailable prerequisite.
In `@apps/studio/state/notebooks/notebooks-state.ts`:
- Around line 21-23: The notebook insertion logic currently marks persisted
notebooks as new, causing edits to follow the creation lifecycle. Update
setNotebook to insert notebooks loaded from persisted content with status saved,
while keeping addNotebook’s status new for locally created notebooks. Add
coverage verifying loaded notebooks retain saved status through edit and save
success/failure flows.
---
Nitpick comments:
In `@apps/studio/state/tabs.tsx`:
- Around line 643-644: Update the `notebook` case in the tab ID generation logic
to cast `params` as `CreateTabIdParams['notebook']` instead of the SQL variant,
while preserving the existing notebook ID format.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e4c8b8e8-2ecc-4b45-9062-1dda88946199
📒 Files selected for processing (6)
apps/studio/components/interfaces/Explorer/hooks.tsapps/studio/components/layouts/ExplorerLayout/ExplorerLayout.tsxapps/studio/state/notebooks/notebook-session-state.tsapps/studio/state/notebooks/notebooks-state.tsapps/studio/state/notebooks/types.tsapps/studio/state/tabs.tsx
🎭 Playwright Test Results (next)Details
Flaky testsFeatures › realtime-inspector.spec.ts › Realtime Inspector › Basic Inspector UI › start/stop listening button works Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/studio/components/interfaces/Explorer/NotebookEditor.tsx`:
- Around line 13-22: Add component tests for the notebook tab-registration
effect in NotebookEditor, covering a valid route ID with notebook ID, notebook
type, loaded notebook name as the label, and matching metadata; also cover the
fallback “New Notebook” label and the missing-ID path where no tab is created.
Use the existing tabs-store and notebook-state test patterns.
In `@apps/studio/state/notebooks/notebooks-state.test.ts`:
- Around line 65-77: Extend the test around notebooksState.setNotebook to assert
that the locally edited markdown cell remains in the notebook’s cells after the
second merge. Keep the existing unsaved status assertion and verify the merged
notebook preserves the content from updateCells rather than replacing it with
fetched cells.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fb6d0880-3a42-4ec2-ba13-34e23024ec55
⛔ Files ignored due to path filters (1)
apps/studio/routeTree.gen.tsis excluded by!**/routeTree.gen.ts
📒 Files selected for processing (10)
apps/studio/TANSTACK_MIGRATION.mdapps/studio/components/interfaces/Explorer/NotebookEditor.tsxapps/studio/components/ui/EntityTypeIcon.tsxapps/studio/pages/project/[ref]/explorer/notebook/[id].tsxapps/studio/routes/project/$ref/explorer.tsxapps/studio/routes/project/$ref/explorer/index.tsxapps/studio/routes/project/$ref/explorer/notebook/$id.tsxapps/studio/state/notebooks/notebooks-state.test.tsapps/studio/state/notebooks/notebooks-state.tsapps/studio/state/tabs.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/studio/state/tabs.tsx
- apps/studio/state/notebooks/notebooks-state.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/studio/components/interfaces/Explorer/__tests__/NotebookEditor.test.tsx`:
- Line 1: Update the NotebookEditor tests to use the Studio test harness:
replace Testing Library’s render with customRender, add addAPIMock for every API
request NotebookEditor requires, and configure the harness to fail on unhandled
requests.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6627f629-bb90-4387-b91f-2cbb76db25c1
📒 Files selected for processing (1)
apps/studio/components/interfaces/Explorer/__tests__/NotebookEditor.test.tsx
charislam
left a comment
There was a problem hiding this comment.
Tested adding a new notebook!
| label: stateNotebook?.notebook.name ?? 'New Notebook', | ||
| metadata: { notebookId: id }, | ||
| }) | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Let's use useEffectEvent instead of hacking around the dependency arrays, we've updated eslint to support it so it actually works properly now 🙌🏼
| type: 'notebook' | ||
| name: string | ||
| description?: string | ||
| visibility: 'user' | 'project' |
There was a problem hiding this comment.
| visibility: 'user' | 'project' | |
| visibility: 'project' |
According to the spec, we're doing shared only, right?
Braintrust eval report
|
…for-pitr-archiving-stale * origin/master: (342 commits) feat(studio): role-aware access feedback in scoped token creation (#48858) Initialize notebook editor page (#48842) test(docs): scan changed pages for WCAG 2.1 A/AA in warn mode (#48727) docs(auth): clarify audit logs storage options and configuration (#48852) feat(studio): warn that scoped tokens don't support the MCP server (#48849) feat(studio): lifecycle and role-aware scoped token view sheet (#48848) feat(www): add Open Authorization Integration Addendum (#48804) feat(studio): add legacy token mode to scoped pat creation flow (#48844) Add blog post: Supabase is now a connector on Perplexity Computer (#48776) feat(studio): enforce expiry scoped pat (#48811) fix(studio): model scoped pat permissions as OR-of-AND alternatives - smaller version (#48809) fix(ui): opaque default button hover fills (#48837) fix(ui): restore normal alert text wrapping (#48840) feat: notebook content schema (#48813) fix(ui): remove extra spacing before custom reports section (#48796) feat(marketing): add hint text below Go page form labels (#48824) Initialize notebooks store (#48801) Use white wordmark for QA.tech primary logo (#48827) fix titleless Admonition alignment (#48784) fix inconsistent product menu dividers (#48787) ...
Context
More groundwork for the Explorer - this one's focused on initializing the valtio store for managing notebooks
Store architecture will follow closely with the existing sql-editor-store
No data persistence yet, but can test creating a new notebook

Which should open a placeholder page

Closing the notebook brings you back to the explorer home page
Summary by CodeRabbit
New Features
Documentation