You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "prathamesh04 (via GitHub)" <gi...@apache.org> on 2026/07/18 01:30:34 UTC

[PR] test(table): add regression test for pagination reset on cell click [superset]

prathamesh04 opened a new pull request, #42155:
URL: https://github.com/apache/superset/pull/42155

   ## Summary
   
   Adds a regression test for #42136 to ensure that clicking a cell in a paginated table does not reset the page index back to page 1.
   
   ## Test description
   
   The test:
   1. Creates a DataTable with 30 rows and page size 10 (3 pages)
   2. Navigates to page 2
   3. Clicks a cell on page 2
   4. Verifies the table stays on page 2 (page doesn't reset to 1)
   
   ## Related
   
   - Follow-up to #42136
   - Closes #42010


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "prathamesh04 (via GitHub)" <gi...@apache.org>.
prathamesh04 commented on PR #42155:
URL: https://github.com/apache/superset/pull/42155#issuecomment-5009526121

   Thanks for the reviews. Updated the test in the latest commit to address the feedback:
   
   - **Before**: Mounted `DataTable` directly with plain `<td>` cell renderers that had no click side effects — clicking a cell did nothing, so the test passed even without the fix
   - **After**: Mounts `TableChart` with cross-filtering enabled (`emitCrossFilters: true`). The test:
     1. Renders 30 rows across 3 pages (page_length: 10)
     2. Navigates to page 2, clicks a cell (triggers `setDataMask` via cross-filter)
     3. Re-renders with filtered data (15 rows) simulating a dashboard filter response
     4. Verifies the page stays on page 2 after the data re-render
   
   This exercises the actual regression path where cross-filter-triggered data re-renders would reset pagination if `autoResetPage` were not set to `false`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42155:
URL: https://github.com/apache/superset/pull/42155#issuecomment-5009190079

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42155:
URL: https://github.com/apache/superset/pull/42155#issuecomment-5009221623

   <!-- Bito Reply -->
   The flagged issue is correct. The current test mounts `DataTable` with plain `<td>` elements that lack the `onClick` handler responsible for triggering cross-filters, meaning the test does not exercise the actual integration path that causes the pagination reset bug. To resolve this, you should update the `Cell` renderer in the test to include the `onClick` handler that mimics the `TableChart` behavior, or mount the `TableChart` component itself to ensure the full integration is tested.
   
   Here is a concise way to update the test columns to include a mock click handler:
   
   ```tsx
   // Update the Cell renderer in the test columns
   Cell: ({ value }: CellProps<DataRow>) => (
     <td onClick={() => console.log('Filter triggered')}>{value}</td>
   ),
   ```
   
   I have checked the PR comments and there are no other pending review comments to address. Would you like me to proceed with any other tasks?
   
   **superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx**
   ```
   Cell: ({ value }: CellProps<DataRow>) => (
     <td onClick={() => console.log('Filter triggered')}>{value}</td>
   ),
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42155:
URL: https://github.com/apache/superset/pull/42155#issuecomment-5010106267

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #42155:
URL: https://github.com/apache/superset/pull/42155


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #42155:
URL: https://github.com/apache/superset/pull/42155#discussion_r3607268990


##########
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx:
##########
@@ -2292,6 +2292,96 @@ describe('plugin-chart-table', () => {
       });
     });
 
+    test('should not reset pagination when a cell is clicked (#42010)', async () => {
+      type DataRow = {
+        id: number;
+        name: string;
+        value: number;
+      };
+
+      const columns: Column<DataRow>[] = [
+        {
+          Header: 'ID',
+          accessor: 'id',
+          id: 'id',
+          Cell: ({ value }: CellProps<DataRow>) => <td>{value}</td>,
+        },
+        {
+          Header: 'Name',
+          accessor: 'name',
+          id: 'name',
+          Cell: ({ value }: CellProps<DataRow>) => <td>{value}</td>,
+        },
+        {
+          Header: 'Value',
+          accessor: 'value',
+          id: 'value',
+          Cell: ({ value }: CellProps<DataRow>) => <td>{value}</td>,
+        },
+      ];
+
+      // 30 rows with page size 10 = 3 pages
+      const data: DataRow[] = Array.from({ length: 30 }, (_, i) => ({
+        id: i + 1,
+        name: `User ${i + 1}`,
+        value: (i + 1) * 100,
+      }));
+
+      const { container } = render(
+        <ProviderWrapper>
+          <DataTable<DataRow>
+            columns={columns}
+            data={data}
+            rowCount={data.length}
+            pageSize={10}
+            serverPagination={false}
+            serverPaginationData={{}}
+            onServerPaginationChange={jest.fn()}
+            handleSortByChange={jest.fn()}
+            sortByFromParent={[]}
+            onSearchColChange={jest.fn()}
+            searchOptions={[]}
+            sticky={false}
+            searchInput={false}
+            selectPageSize={false}
+          />
+        </ProviderWrapper>,
+      );
+
+      // Verify we're on page 1 (showing rows 1-10)
+      const getRowTexts = () =>
+        Array.from(container.querySelectorAll('tbody td:nth-child(2)')).map(
+          td => td.textContent,
+        );
+      expect(getRowTexts()).toContain('User 1');
+      expect(getRowTexts()).not.toContain('User 11');
+
+      // Navigate to page 2 by clicking the page 2 link
+      const page2Link = container.querySelector('a[href="#page-1"]')!;
+      expect(page2Link).toBeTruthy();
+      fireEvent.click(page2Link);
+
+      // Wait for page 2 to render (showing rows 11-20)
+      await waitFor(() => {
+        expect(getRowTexts()).toContain('User 11');
+        expect(getRowTexts()).not.toContain('User 1');
+      });
+
+      // Click a cell on page 2
+      const cell = screen.getByText('User 11');
+      fireEvent.click(cell);
+

Review Comment:
   **Suggestion:** This regression test does not exercise the real bug path because it mounts `DataTable` with plain `<td>` cell renderers that have no click side effects. Clicking `User 11` here only clicks static text, so no filter/state update occurs and pagination cannot reset, which means the test can pass even if the original cell-click pagination regression in `TableChart` still exists. Mount the chart-level component/path that wires cell `onClick` behavior (or explicitly add equivalent click handlers in the test columns) so the test validates the actual integration that regressed. [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ TableChart cell-click pagination regression may go undetected.
   - ⚠️ Cross-filter table behavior lacks effective regression test.
   - ⚠️ Test suite gives false confidence about pagination stability.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Inspect the TableChart cell click behavior in
   `superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx` around lines 1059–1237,
   where `getColumnConfigs` defines a `Cell` renderer that returns a styled <td> with an
   `onClick` handler calling `toggleFilter(key, value)` when `emitCrossFilters` is true, and
   `DataTable` is wired via `cell.render('Cell', { key: cell.column.id })` in `DataTable.tsx`
   lines 400–408.
   
   2. Note that the new regression test in
   `superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx` lines 96–120
   defines `columns: Column<DataRow>[]` where each `Cell: ({ value }: CellProps<DataRow>) =>
   <td>{value}</td>,` (lines 108, 114, 120) returns a plain <td> element with no `onClick` or
   cross-filter side effects.
   
   3. Observe that the test mounts `<DataTable<DataRow> ... />` directly (lines 13–28) with
   these columns and then does `const cell = screen.getByText('User 11');
   fireEvent.click(cell);` (lines 52–53), so the click targets a bare <td> without any event
   handler wired by TableChart’s `toggleFilter` logic.
   
   4. If the original pagination-reset bug in TableChart is reintroduced (for example by
   reverting the `autoResetPage` logic or the cross-filter handling in `TableChart.tsx` while
   leaving DataTable unchanged), clicks on real chart cells would again reset the page in the
   UI, but this test would still pass because it never exercises TableChart’s `Cell`
   `onClick` path—only static DataTable cells—so no filter/state change occurs and pagination
   cannot reset under this test setup.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e954f1ed61de4af9bdccaff3228a9e1f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e954f1ed61de4af9bdccaff3228a9e1f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
   **Line:** 2307:2373
   **Comment:**
   	*Incomplete Implementation: This regression test does not exercise the real bug path because it mounts `DataTable` with plain `<td>` cell renderers that have no click side effects. Clicking `User 11` here only clicks static text, so no filter/state update occurs and pagination cannot reset, which means the test can pass even if the original cell-click pagination regression in `TableChart` still exists. Mount the chart-level component/path that wires cell `onClick` behavior (or explicitly add equivalent click handlers in the test columns) so the test validates the actual integration that regressed.
   
   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
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42155&comment_hash=6334db28361ae05cfe4cfd71cfd36d67be187897ff19e68bb36b4c0204e9bc7e&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42155&comment_hash=6334db28361ae05cfe4cfd71cfd36d67be187897ff19e68bb36b4c0204e9bc7e&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] test(table): add regression test for pagination reset on cell click [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42155:
URL: https://github.com/apache/superset/pull/42155#issuecomment-5009238987

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42155?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 65.08%. Comparing base ([`ce8d439`](https://app.codecov.io/gh/apache/superset/commit/ce8d4397cdd2d9bd8fbccfd53b36908ab0e9ee9c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7676d1b`](https://app.codecov.io/gh/apache/superset/commit/7676d1bc581dd32131b03851a5fa71f92d556ece?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #42155      +/-   ##
   ==========================================
   + Coverage   65.07%   65.08%   +0.01%     
   ==========================================
     Files        2758     2758              
     Lines      155222   155222              
     Branches    35570    35570              
   ==========================================
   + Hits       101008   101026      +18     
   + Misses      52299    52281      -18     
     Partials     1915     1915              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/42155/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/42155/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.77% <ø> (+0.02%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/42155?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org