Notebook: fix "TabsContent must be used within Tabs" on multi-statement SQL cells - #116
Merged
Merged
Conversation
…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.
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a notebook that contains a SQL cell with multiple statements crashed the page with:
Root cause
SqlCellView(src/routes/notebooks.$id.tsx) renders the sharedResultContent(from the DB console) without aTabswrapper. When$psqlreturns more than one result set (multi-statement SQL),ResultContentrenders 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 aQuery-1 (N)/Query-2 (M)switcher — mirroring the DB consoleResultPanel. This also makes the extra result sets reachable in notebooks (previously the header summed all rows but only one set was ever renderable).safeActiveclamps the active index so a shorter re-run cannot point past the results.Testing
pnpm typecheck— cleanbiome check— cleanSELECTs now shows tabbed results instead of the error screen.