Repository navigation
Conversation
Code Review Agent Run #eda19dActionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #3cbfd9Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
There was a problem hiding this comment.
Pull request overview
This PR reduces duplicate backend queries in Explore by reusing the chart’s existing queriesResponse for the Results tab (when available), avoiding a separate resultType='results' request.
Changes:
- Pass
chart.queriesResponsefromExploreChartPanelintoDataTablesPane/useResultsPane. - Reuse v1-shaped
queriesResponsedata inuseResultsPane, with a fallback to the existing API call for legacy responses. - Reset
isRequest.resultsduring chart loading to prevent the “chart + results” race from firing two requests at once.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| superset-frontend/src/explore/components/ExploreChartPanel/index.tsx | Wires chart.queriesResponse through to the data panel. |
| superset-frontend/src/explore/components/DataTablesPane/types.ts | Adds queriesResponse to relevant props typing. |
| superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx | Implements reuse of Redux query data with API fallback. |
| superset-frontend/src/explore/components/DataTablesPane/components/ResultsPaneOnDashboard.tsx | Passes queriesResponse through to the shared hook. |
| superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx | Resets results request state during loading; forwards queriesResponse. |
| .finally(() => { | ||
| setIsLoading(false); | ||
| }); | ||
| }, [queryFormData, isRequest]); |
There was a problem hiding this comment.
useEffect now depends on queriesResponse/queryForce/ownState/errorMessage (and uses setForceQuery), but the dependency array is still [queryFormData, isRequest]. This can prevent the new reuse-path from running when queriesResponse arrives/changes (e.g., after the chart request completes without queryFormData changing) and may also trigger react-hooks/exhaustive-deps lint failures. Update the dependencies or refactor (e.g., separate effect keyed by queriesResponse + isRequest) so results update reliably without an extra API call.
| }, [queryFormData, isRequest]); | |
| }, [ | |
| queryFormData, | |
| isRequest, | |
| queriesResponse, | |
| queryForce, | |
| ownState, | |
| errorMessage, | |
| ]); |
| // Reuse chart data from Redux when available. The chart visualization | ||
| // query and the results query produce identical SQL on the backend, | ||
| // so there is no need for a separate network request. | ||
| if (queriesResponse?.length && 'colnames' in queriesResponse[0]) { | ||
| const mapped = queriesResponse.map(q => { |
There was a problem hiding this comment.
The new branch that reuses queriesResponse (skipping getChartDataRequest) isn’t covered by existing tests. Consider adding a unit test that passes a v1-shaped queriesResponse and asserts no network request is made and the table renders from Redux data, plus a test that verifies an update when queriesResponse changes.
3cf6dfb to
498cf65
Compare
rusackas
left a comment
There was a problem hiding this comment.
Rebased this onto current master and pushed for you, the conflict was just the cappedFormData / import-path churn from a recent refactor. The DataTablesPane jest tests pass locally, CI re-running 🤞
Nice writeup on the root cause. The backend reasoning checks out too, _get_results is just a passthrough to _get_full, so reusing chart.queriesResponse gives identical data/colnames/coltypes. So the dedup itself looks right.
One thing I want to be sure of before merging: with the Redux reuse path, does the row-limit dropdown in the Results tab still do anything for v1 charts? Looks like changing it updates cappedFormData, but the effect re-enters the reuse branch and renders the chart's data regardless of the new limit... so the control might be a silent no-op now. Worth confirming, and maybe a small test around the reuse vs fallback split since there's no coverage on it yet. Thoughts @kimsehwan96?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #38165 +/- ##
=======================================
Coverage 64.60% 64.60%
=======================================
Files 2684 2684
Lines 148378 148397 +19
Branches 34187 34194 +7
=======================================
+ Hits 95855 95872 +17
- Misses 50769 50771 +2
Partials 1754 1754
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #e42bebActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@kimsehwan96 just checking in on this PR again :) Thanks for the help here. The reuse branch renders |
498cf65 to
0b44ea2
Compare
| const props = createResultsPaneOnDashboardProps({ | ||
| sliceId: 203, | ||
| // legacy shape: present but without the v1 `colnames` discriminator | ||
| queriesResponse: [{ data: [{ genre: 'ignored' }] }] as any, |
There was a problem hiding this comment.
Suggestion: Replace the any cast with a concrete test-safe type (or a narrow reusable generic/union) that represents the legacy queriesResponse shape without disabling type checking. [custom_rule]
Severity Level: Minor
Why it matters? 🤔
The file is a new/modified TypeScript test file, and it contains an explicit as any cast. This directly violates the rule against using any in changed TypeScript/TSX code, so the suggestion is verified.
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/explore/components/DataTablesPane/test/useResultsPane.test.tsx
**Line:** 107:107
**Comment:**
*Custom Rule: Replace the `any` cast with a concrete test-safe type (or a narrow reusable generic/union) that represents the legacy `queriesResponse` shape without disabling type checking.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@rusackas Hi ! sorry for late response. I added some tests and fix Results-tab-row-limit dropdown related issue. 2026-06-25.9.11.00.movIf there is more changes needed than feel free to request changes to me or make change with your own! Thank you for feedback. |
0b44ea2 to
61ff26e
Compare
| async openResultsTab(): Promise<void> { | ||
| await this.expandDataPanel(); | ||
| const resultsTab = this.page | ||
| .locator(ExplorePage.SELECTORS.SOUTH_PANE) | ||
| .locator(ExplorePage.SELECTORS.RESULTS_TAB); | ||
| await resultsTab.click(); | ||
| } |
There was a problem hiding this comment.
Suggestion: openResultsTab() always clicks the Results tab even when it is already active. In DataTablesPane, clicking the active tab collapses the panel, so this helper can close the data panel instead of opening it (especially right after expanding a collapsed panel where Results is already selected by default). Guard the click so it only runs when Results is not already active. [logic error]
Severity Level: Critical 🚨
- ❌ Results tab Playwright test collapses panel instead of opening.
- ⚠️ Flaky or failing end-to-end coverage for Results reuse.Steps of Reproduction ✅
1. Run the Playwright spec
`superset-frontend/playwright/tests/experimental/explore/results-tab-reuse.spec.ts`, which
constructs an `ExplorePage` and navigates to Explore (`ExplorePage.goto()` at lines 13–18
of the snippet, using `ExplorePage` from
`superset-frontend/playwright/pages/ExplorePage.ts`).
2. Observe that `results-tab-reuse.spec.ts` calls `await explorePage.openResultsTab();`
(lines 26–28 of the snippet), which in turn invokes `ExplorePage.openResultsTab()` at
`superset-frontend/playwright/pages/ExplorePage.ts:133-139`.
3. When `openResultsTab()` runs, it first calls `expandDataPanel()`, which clicks the
caret button with `aria-label="Expand data panel"` if visible (`DataTablesPane` renders
this caret in `CollapseButton` with that aria-label at
`superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx:161-185`),
causing `handleCollapseChange(true)` to set `panelOpen` to `true`
(`DataTablesPane.tsx:140-145`).
4. Immediately after expansion, `openResultsTab()` unconditionally clicks the Results tab
(`[data-node-key="results"]`), which triggers `Tabs` `onTabClick` -> `handleTabClick` in
`DataTablesPane.tsx:148-158`; since `panelOpen` is `true` and `activeTabKey` is already
`ResultTypes.Results` (`useState` default at `DataTablesPane.tsx:92`), the branch `else if
(tabKey === activeTabKey)` executes, calling `handleCollapseChange(false)` and collapsing
the panel, so the AG Grid inside the Results pane is hidden and `AgGrid.waitForRows()`
(which waits for visible rows in
`superset-frontend/playwright/components/core/AgGrid.ts:50-55`) can time out or fail to
find a visible grid.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/playwright/pages/ExplorePage.ts
**Line:** 133:139
**Comment:**
*Logic Error: `openResultsTab()` always clicks the Results tab even when it is already active. In `DataTablesPane`, clicking the active tab collapses the panel, so this helper can close the data panel instead of opening it (especially right after expanding a collapsed panel where Results is already selected by default). Guard the click so it only runs when Results is not already active.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix61ff26e to
875b08b
Compare
875b08b to
15f8ea3
Compare
Code Review Agent Run #0f5847Actionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
15f8ea3 to
8caf872
Compare
8caf872 to
e56eeed
Compare
Code Review Agent Run #9a2949Actionable Suggestions - 0Additional SuggestionsFiltered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules. Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
The Results tab in DataTablesPane independently fires a separate API request with resultType='results', which produces identical SQL to the chart's resultType='full' request on the backend. This doubles database load on every chart execution when the Results tab is open. - Reset isRequest.results to false during chart loading to prevent race condition where both requests fire simultaneously - Pass chart.queriesResponse from Redux through to useResultsPane - Reuse chart data directly when available (v1 API), falling back to API call for legacy charts Closes apache#38152
Address review feedback: destructure and forward the queriesResponse prop to useResultsPane for interface contract consistency.
e56eeed to
56ea8e1
Compare
There was a problem hiding this comment.
Code Review Agent Run #f57987
Actionable Suggestions - 2
-
superset-frontend/playwright/tests/experimental/explore/results-tab-reuse.spec.ts - 1
- Extract duplicated chart creation code · Line 74-74
-
superset-frontend/src/explore/components/DataTablesPane/components/ResultsPaneOnDashboard.tsx - 1
- Prop optimization unused by caller · Line 59-59
Additional Suggestions - 2
-
superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx - 1
-
Missing test for loading behavior · Line 132-134The new `useEffect` block at lines 132-134 that resets `isRequest.results` when `panelOpen && chartStatus === 'loading'` has no test coverage in `DataTablesPane.test.tsx`. Existing tests use `chartStatus: 'rendered'`, so this loading-state branch is never exercised. Without a test, regression in the loading-to-results transition could go undetected.
-
-
superset-frontend/src/explore/components/DataTablesPane/test/useResultsPane.test.tsx - 1
-
Missing pre-API-state assertion · Line 107-107This test for the partial-v1-shape fallback path asserts the API populates 'Indie' but never verifies that the initial state (before the API resolves) is empty. Without checking the pre-API state, a regression where the component renders stale or uninitialized data would go undetected.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
superset-frontend/playwright/pages/ExplorePage.ts - 1
- Inverted visibility logic bug · Line 120-127
-
superset-frontend/src/explore/components/DataTablesPane/test/fixture.tsx - 1
- Inconsistent spread pattern · Line 126-126
Review Details
-
Files reviewed - 9 · Commit Range:
b838903..56ea8e1- superset-frontend/playwright/pages/ExplorePage.ts
- superset-frontend/playwright/tests/experimental/explore/results-tab-reuse.spec.ts
- superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx
- superset-frontend/src/explore/components/DataTablesPane/components/ResultsPaneOnDashboard.tsx
- superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx
- superset-frontend/src/explore/components/DataTablesPane/test/fixture.tsx
- superset-frontend/src/explore/components/DataTablesPane/test/useResultsPane.test.tsx
- superset-frontend/src/explore/components/DataTablesPane/types.ts
- superset-frontend/src/explore/components/ExploreChartPanel/index.tsx
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| }; | ||
| const chartResp = await apiPostChart(page, { | ||
| slice_name: `results_tab_reuse_${Date.now()}`, | ||
| viz_type: 'table', |
There was a problem hiding this comment.
The chart creation logic (14 lines) is duplicated across results-tab-reuse.spec.ts (line 74-87) and handlebars-format-date.spec.ts (line 74-87). Consider extracting into a helper function to improve maintainability. A similar 11-line duplication also exists in the same files (lines 54-64).
Code Review Run #f57987
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
| dataSize = 50, | ||
| canDownload, | ||
| columnDisplayNames, | ||
| queriesResponse, |
There was a problem hiding this comment.
The queriesResponse prop added at lines 59 and 72 enables useResultsPane to skip a redundant API call when chart results are already available (useResultsPane.tsx:109-129). However, the sole caller at dashboard/components/SliceHeaderControls/index.tsx:516-524 does not pass this prop, so the optimization never executes in practice.
Code Review Run #f57987
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
rusackas
left a comment
There was a problem hiding this comment.
Thanks @kimsehwan96, LGTM! The row-limit slicing on the reuse path settles my earlier concern, and the reuse-vs-fallback tests are just what I was hoping for.
User description
The Results tab in DataTablesPane independently fires a separate API request with resultType='results', which produces identical SQL to the chart's resultType='full' request on the backend. This doubles database load on every chart execution when the Results tab is open.
Closes #38152
SUMMARY
The Results tab in the Explore view's DataTablesPane fires an independent API request (
resultType='results') every time a chart query runs. On the backend,_get_results()is a pure pass-through to_get_full()— both produce identical SQL. This means every chart execution with the Results tab open sends two duplicate database queries simultaneously.Root cause (two issues):
Race condition in
DataTablesPane:isRequest.resultsis not reset tofalsewhenchartStatustransitions to'loading'. WhenqueryFormDatachanges during chart loading,useResultsPane's effect fires immediately — sending the Results request at the same time as the chart request.Redundant API call in
useResultsPane: The hook always fetches data via a separate network request, even though identical data is already available in Redux (chart.queriesResponse) after the chart query completes.Fix:
isRequest.resultstofalsewhenchartStatus === 'loading'to prevent the race conditionchart.queriesResponsefrom Redux throughExploreChartPanel→DataTablesPane→useResultsPanequeriesResponsecontains v1 API data (hascolnamesfield), reuse it directly — skipping the separate API call entirelyqueriesResponsefall back to the existing API callResult: One database query instead of two per chart execution. Results tab data appears instantly from Redux without a network round-trip.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
AS-IS duplicated query was submitted to trino
TO-BE only one query was submitted to trino and the result will be used in chart and result panels.
TESTING INSTRUCTIONS
Build it locally and creating environment with docker-compose and tested it.
ADDITIONAL INFORMATION
CodeAnt-AI Description
Reuse chart query data in Results tab to avoid duplicate backend queries
What Changed
Impact
✅ Lower database load during chart execution✅ Fewer duplicate queries when viewing Results✅ Faster Results display when chart data is already loaded💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.