Skip to content

Notebook: fix "TabsContent must be used within Tabs" on multi-statement SQL cells - #116

Merged
Panthevm merged 1 commit into
masterfrom
notebook-sql-multi-result-tabs
Jul 7, 2026
Merged

Notebook: fix "TabsContent must be used within Tabs" on multi-statement SQL cells#116
Panthevm merged 1 commit into
masterfrom
notebook-sql-multi-result-tabs

Conversation

@Panthevm

@Panthevm Panthevm commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

Opening a notebook that contains a SQL cell with multiple statements crashed the page with:

TabsContent must be used within Tabs

Root cause

SqlCellView (src/routes/notebooks.$id.tsx) renders the shared ResultContent (from the DB console) without a Tabs wrapper. When $psql returns more than one result set (multi-statement SQL), ResultContent renders one <TabsContent> per result, which requires a parent Radix <Tabs> context. With a single result it renders the table directly, so the crash only surfaced for multi-statement cells.

Fix

Wrap the SQL result in <Tabs> and, when there is more than one result, render a Query-1 (N) / Query-2 (M) switcher — mirroring the DB console ResultPanel. This also makes the extra result sets reachable in notebooks (previously the header summed all rows but only one set was ever renderable). safeActive clamps the active index so a shorter re-run cannot point past the results.

Testing

  • pnpm typecheck — clean
  • biome check — clean
  • Manual: a notebook SQL cell with several SELECTs now shows tabbed results instead of the error screen.

…nt SQL cells

SqlCellView rendered the shared DB-console ResultContent without a Tabs
wrapper. When $psql returns more than one result set, ResultContent emits
one <TabsContent> per result, which needs a parent Radix <Tabs> context,
so opening such a notebook crashed. Single-result cells render the table
directly, so the crash only showed up for multi-statement SQL.

Wrap the result in <Tabs> and, when there is more than one result, render
a Query-1 (N) / Query-2 (M) switcher, mirroring the DB console ResultPanel.
safeActive clamps the active index so a shorter re-run cannot point past
the results.
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Panthevm
Panthevm merged commit b7ad77a into master Jul 7, 2026
4 checks passed
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.

1 participant