Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
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 (6)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughNotebook database cells now support persisted table and chart views. Chart settings control type, axes, scale, cumulative values, and labels. QueryCell selects the configured renderer, and shared bar and line charts support configurable X-axis fields. ChangesNotebook query display
Estimated code review effort: 4 (Complex) | ~45 minutes Mergeability Score: 🔵 Low · up to The PR adds chart display settings, but log-scale settings can still be configured or emitted even though charts render linearly, so affected notebook charts may silently ignore the selected scale. This is a bounded correctness issue requiring explicit owner follow-up, but it is not a broad merge blocker. Sequence Diagram(s)sequenceDiagram
participant User
participant DisplaySettingsButton
participant NotebookState
participant QueryCell
participant QueryResultChart
User->>DisplaySettingsButton: Select view and chart settings
DisplaySettingsButton->>NotebookState: Replace matching database cell
NotebookState-->>QueryCell: Provide updated cell snapshot
QueryCell->>QueryResultChart: Render configured chart view
QueryResultChart->>QueryResultChart: Map rows and apply cumulative results
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (5)
apps/studio/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsx (1)
51-80: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider deriving the chart defaults from one shared constant.
onUpdateChartConfigrepeats every default value ('bar','',false,'linear',false).DisplaySettingsButtonrepeats the same defaults at Lines 34-41, andapps/studio/components/interfaces/Explorer/hooks.tssets the initial cell state. Export oneDEFAULT_CHART_CONFIGfromapps/studio/data/content/notebooks/notebook-schema.tsand reuse it in all three places.🤖 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/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsx` around lines 51 - 80, Export a shared DEFAULT_CHART_CONFIG from notebook-schema.ts containing the chart defaults, then replace the inline defaults in onUpdateChartConfig, DisplaySettingsButton’s existing initialization, and the initial cell state in hooks.ts with that constant. Preserve each location’s existing chart merge and override behavior.apps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx (1)
14-14: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueLog scale is still pending, and the cumulative result is computed even when it is unused.
Two notes:
- Line 14 records the pending log scale work.
DisplaySettingsButtonalready lets the user selectLogarithmic.cumulativeResultsruns on everyresultchange, including whencumulativeisfalse.Do you want me to open a new issue to track the log scale implementation?
Also applies to: 21-25
🤖 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/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx` at line 14, Implement logarithmic chart scaling in QueryResultChart using QueryBlock.tsx’s effectiveLogScale behavior, preserving the DisplaySettingsButton Logarithmic selection. Update cumulativeResults calculation so it only runs when cumulative is enabled, while retaining the existing result-change behavior when cumulative is true.apps/studio/components/interfaces/Explorer/QueryResultTable.tsx (1)
26-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueThe note matches the co-location guideline.
QueryResultTableis used only byapps/studio/components/interfaces/Explorer/QueryCell/index.tsx, so moving it into theQueryCellfolder follows the guideline. When you move it, update the importer directly and do not add a re-export shim.Do you want me to open a new issue to track the move?
As per coding guidelines: "Co-locate sub-components with their parent and avoid barrel re-export files." and "When moving or extracting code, update every importer to the new module directly; do not leave backward-compatibility re-export shims."
🤖 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/components/interfaces/Explorer/QueryResultTable.tsx` around lines 26 - 27, Move the QueryResultTable component into the QueryCell folder to co-locate it with its sole consumer, QueryCell/index.tsx. Update that importer to reference the new module path directly, and do not add a re-export shim or barrel file.Source: Coding guidelines
packages/ui-patterns/src/Chart/charts/chart-bar.tsx (2)
203-213: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winBoth charts drop the x value from the tooltip for non-timestamp axes. The shared root cause is the
labelFormatterfallback, which returns the literal string'Value'instead of the hovered x value. The user then cannot tell which category the tooltip describes.
packages/ui-patterns/src/Chart/charts/chart-bar.tsx#L203-L213: returnString(v)in the non-timestamp branch oflabelFormatter.packages/ui-patterns/src/Chart/charts/chart-line.tsx#L229-L235: apply the same change to the non-timestamp branch oflabelFormatter.🤖 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 `@packages/ui-patterns/src/Chart/charts/chart-bar.tsx` around lines 203 - 213, Update the labelFormatter in packages/ui-patterns/src/Chart/charts/chart-bar.tsx at lines 203-213 and packages/ui-patterns/src/Chart/charts/chart-line.tsx at lines 229-235 so the non-timestamp branch returns String(v) instead of the literal "Value"; preserve the existing timestamp formatting branch in both charts.
118-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueThe
xAxisConfigblock is duplicated across both chart components. Both files add the same twelve lines, including thexKey === 'timestamp'special cases elsewhere in each file. The two copies will drift.
packages/ui-patterns/src/Chart/charts/chart-bar.tsx#L118-L129: replace the inline object with a call to a sharedgetXAxisConfig({ xKey, showXAxis })helper in theChartpackage.packages/ui-patterns/src/Chart/charts/chart-line.tsx#L135-L146: use the same shared helper.🤖 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 `@packages/ui-patterns/src/Chart/charts/chart-bar.tsx` around lines 118 - 129, Create a shared Chart-package helper named getXAxisConfig accepting xKey and showXAxis, including the common configuration and xKey === 'timestamp' special cases; replace the inline xAxisConfig objects in packages/ui-patterns/src/Chart/charts/chart-bar.tsx lines 118-129 and packages/ui-patterns/src/Chart/charts/chart-line.tsx lines 135-146 with calls to that helper.
🤖 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/QueryCell/DisplaySettingsButton.tsx`:
- Around line 94-99: Update the onValueChange handlers for the ToggleGroup
controls in DisplaySettingsButton to ignore empty-string values emitted when the
active option is deselected, returning without calling the view/type change
callbacks. Remove the blind TypeScript casts and only pass validated non-empty
values to onChangeView and the corresponding chart-type handler.
- Around line 169-184: Update the SelectValue placeholder in the scale control
within DisplaySettingsButton to describe scale selection rather than column
selection, and prevent users from choosing the unsupported logarithmic scale by
disabling its SelectItem (or removing the control) until QueryResultChart
applies scale. Preserve linear scale behavior and the existing
onUpdateChartConfig flow.
- Around line 43-49: Update onChangeView to restrict the mapped-cell update to
cells whose _tag is database_cell, matching the guard in onUpdateChartConfig.
Preserve unchanged cells and ensure the resulting cell retains its
discriminated-union type while only database cells receive the new view.
In `@apps/studio/components/interfaces/Explorer/QueryCell/index.tsx`:
- Around line 120-124: The disabled DisplaySettingsButton in the QueryCell
result-display flow needs to explain why it cannot be used. Preserve the
existing disabled condition, but apply the established apps/studio
disabled-button tooltip wrapper pattern around DisplaySettingsButton and show
“Run the query to configure the result display” while disabled instead of the
generic “Result settings” tooltip.
In `@apps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx`:
- Around line 27-36: Update the result guard in the chart component to detect
failed queries where result exists but result.rows is undefined, and render the
same QueryError branch used by QueryResultTable before the chart render.
Preserve the existing NoDataPlaceholder behavior for missing results or
explicitly empty row arrays.
- Line 20: Normalize the selected x_column and y_column values from
QueryResult.rows to string or number before assigning resultToRender to ChartBar
and ChartLine. Update the data preparation near hasConfig and preserve the
existing chart rendering flow while ensuring no unknown values reach either
chart component.
In `@apps/studio/data/content/notebooks/notebook-schema.ts`:
- Line 54: Update the view field in notebookDomainSchema to provide a default
value when existing notebook content omits it, while preserving the current
table/chart enum validation for explicitly supplied values.
---
Nitpick comments:
In
`@apps/studio/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsx`:
- Around line 51-80: Export a shared DEFAULT_CHART_CONFIG from
notebook-schema.ts containing the chart defaults, then replace the inline
defaults in onUpdateChartConfig, DisplaySettingsButton’s existing
initialization, and the initial cell state in hooks.ts with that constant.
Preserve each location’s existing chart merge and override behavior.
In `@apps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx`:
- Line 14: Implement logarithmic chart scaling in QueryResultChart using
QueryBlock.tsx’s effectiveLogScale behavior, preserving the
DisplaySettingsButton Logarithmic selection. Update cumulativeResults
calculation so it only runs when cumulative is enabled, while retaining the
existing result-change behavior when cumulative is true.
In `@apps/studio/components/interfaces/Explorer/QueryResultTable.tsx`:
- Around line 26-27: Move the QueryResultTable component into the QueryCell
folder to co-locate it with its sole consumer, QueryCell/index.tsx. Update that
importer to reference the new module path directly, and do not add a re-export
shim or barrel file.
In `@packages/ui-patterns/src/Chart/charts/chart-bar.tsx`:
- Around line 203-213: Update the labelFormatter in
packages/ui-patterns/src/Chart/charts/chart-bar.tsx at lines 203-213 and
packages/ui-patterns/src/Chart/charts/chart-line.tsx at lines 229-235 so the
non-timestamp branch returns String(v) instead of the literal "Value"; preserve
the existing timestamp formatting branch in both charts.
- Around line 118-129: Create a shared Chart-package helper named getXAxisConfig
accepting xKey and showXAxis, including the common configuration and xKey ===
'timestamp' special cases; replace the inline xAxisConfig objects in
packages/ui-patterns/src/Chart/charts/chart-bar.tsx lines 118-129 and
packages/ui-patterns/src/Chart/charts/chart-line.tsx lines 135-146 with calls to
that helper.
🪄 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: b4677173-d413-4290-8d9e-d3927583044d
📒 Files selected for processing (9)
apps/studio/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsxapps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsxapps/studio/components/interfaces/Explorer/QueryCell/index.tsxapps/studio/components/interfaces/Explorer/QueryResultTable.tsxapps/studio/components/interfaces/Explorer/hooks.tsapps/studio/components/ui/QueryBlock/QueryBlock.utils.tsapps/studio/data/content/notebooks/notebook-schema.tspackages/ui-patterns/src/Chart/charts/chart-bar.tsxpackages/ui-patterns/src/Chart/charts/chart-line.tsx
| const chartConfigSchema = z.object({ | ||
| type: z.enum(['bar', 'line']), | ||
| x_column: z.string(), | ||
| y_column: z.string(), |
There was a problem hiding this comment.
Are we going to support multiple series? In that case, we might want to make this an array.
bc73831 to
fd3a4ab
Compare
fd3a4ab to
0c73b78
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx (1)
24-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse guideline-compliant local boolean names.
Preserve the serialized
cumulativeandshow_labelsfield names, but alias them toisCumulativeandshowLabelswhen destructuring. Update the derived value and JSX props to use the aliases.Proposed refactor
- const { type, x_column, y_column, cumulative, show_labels } = chart ?? {} + const { + type, + x_column: xColumn, + y_column: yColumn, + cumulative: isCumulative, + show_labels: showLabels, + } = chart ?? {} - const hasConfig = !!x_column && !!y_column + const hasConfig = !!xColumn && !!yColumn - const xKey = x_column ?? '' - const yKey = y_column ?? '' + const xKey = xColumn ?? '' + const yKey = yColumn ?? '' - const resultToRender = cumulative ? cumulativeResults : chartRows + const resultToRender = isCumulative ? cumulativeResults : chartRows - xKey={x_column} - dataKey={y_column} - showXAxis={show_labels} - showYAxis={show_labels} + xKey={xColumn} + dataKey={yColumn} + showXAxis={showLabels} + showYAxis={showLabels}As per coding guidelines, boolean names must begin with
is,has,can, orshould.🤖 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/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx` around lines 24 - 25, In the QueryResultChart component, alias the serialized chart fields cumulative and show_labels to the local booleans isCumulative and showLabels during destructuring. Update the derived value and all JSX props that currently reference cumulative or show_labels to use these aliases, while preserving the serialized field names.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/data/content/notebooks/notebook-schema.ts`:
- Around line 17-22: Restrict the scale field in the notebook schema to the
supported linear value by removing the log option from its z.enum definition.
Ensure the corresponding settings UI does not offer or persist log, leaving the
existing linear default and behavior unchanged.
---
Nitpick comments:
In `@apps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsx`:
- Around line 24-25: In the QueryResultChart component, alias the serialized
chart fields cumulative and show_labels to the local booleans isCumulative and
showLabels during destructuring. Update the derived value and all JSX props that
currently reference cumulative or show_labels to use these aliases, while
preserving the serialized field names.
🪄 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: a36eff67-f369-4c64-99e8-0406d3c39609
📒 Files selected for processing (5)
apps/studio/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsxapps/studio/components/interfaces/Explorer/QueryCell/QueryResultChart.tsxapps/studio/components/ui/QueryBlock/QueryBlock.utils.tsapps/studio/data/content/notebooks/notebook-schema.tsapps/studio/tests/components/ui/QueryBlock/QueryBlock.utils.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/studio/components/interfaces/Explorer/QueryCell/DisplaySettingsButton.tsx
- apps/studio/components/ui/QueryBlock/QueryBlock.utils.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/lib/ai/tools/mock-tools.ts`:
- Line 195: Change the scale value in the mock query-cell creation or
restoration flow to 'linear' instead of the unsupported 'log' value, preserving
the mock’s existing behavior otherwise.
🪄 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: 0535ba53-0c5f-494f-9ecb-687b8add1a31
📒 Files selected for processing (1)
apps/studio/lib/ai/tools/mock-tools.ts
Braintrust eval report
|
Context
Related to Explorer / Notebooks - this adds chart functionality for the Query cells

Query results can be rendered as either bar or line chart - using the chart packages from
ui-patterns[NOTE]: For design team reviewers - am patching the chart packages to be agnostic to the
timestampproperty within the provided data set. Would love to use this component from a consistency POV instead of the oldBarChartcomponent we have.Have intentionally omitted log scale functionality from this PR - will have that separately 🙏
Summary by CodeRabbit
New Features
Improvements