Skip to content

test(table): add regression test for pagination reset on cell click#42155

Open
prathamesh04 wants to merge 2 commits into
apache:masterfrom
prathamesh04:test/table-pagination-regression
Open

test(table): add regression test for pagination reset on cell click#42155
prathamesh04 wants to merge 2 commits into
apache:masterfrom
prathamesh04:test/table-pagination-regression

Conversation

@prathamesh04

Copy link
Copy Markdown
Contributor

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

Adds a regression test verifying that clicking a cell in a paginated
table does not reset the page index back to page 1.

Closes apache#42010
@dosubot dosubot Bot added the viz:charts:table Related to the Table chart label Jul 18, 2026
@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f52f1e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7676d1b..7676d1b
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

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:

// 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>
),

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.07%. Comparing base (ce8d439) to head (3a22d38).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42155   +/-   ##
=======================================
  Coverage   65.07%   65.07%           
=======================================
  Files        2758     2758           
  Lines      155222   155222           
  Branches    35570    35570           
=======================================
+ Hits       101008   101017    +9     
+ Misses      52299    52290    -9     
  Partials     1915     1915           
Flag Coverage Δ
javascript 70.76% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…-filtering

Replace the DataTable-level test that clicked static <td> elements
(no side effects) with a TableChart integration test that:
- Renders 30 rows across 3 pages with cross-filtering enabled
- Navigates to page 2, clicks a cell to trigger setDataMask
- Re-renders with filtered data (15 rows) simulating a dashboard filter
- 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.
@prathamesh04

Copy link
Copy Markdown
Contributor Author

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.

@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #209c28

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7676d1b..3a22d38
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/M viz:charts:table Related to the Table chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking in a paginated table jumps the user back to the first page

1 participant