Skip to content

fix(table): respect row limit with server pagination - #41024

Merged
rusackas merged 5 commits into
apache:masterfrom
innovark37:innovark/fix/table-server-pagination-row-limit
Jun 23, 2026
Merged

rusackas merged 5 commits into
apache:masterfrom
innovark37:innovark/fix/table-server-pagination-row-limit

Conversation

@innovark37

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes Table chart server pagination so the main data query respects the configured row limit.

When Table chart server pagination is enabled, Superset runs separate queries for the current page data and for the total row count. The row count query already uses the configured Row limit, but the current page data query used only the Server Page Length.

This could make the table preview show more rows than the configured Row limit allows. The fix makes the current page data query cap its page size by the remaining rows within the Row limit.

For example:

  • row_limit = 120, server_page_length = 50 showed 3 pages, but the last page could request 50 rows instead of the remaining 20.
  • row_limit = 10, server_page_length = 20 could display 20 rows in preview even though the chart row limit was 10.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. Create or edit a Table chart.
  2. Enable Server pagination.
  3. Set Server Page Length to 50.
  4. Manually set Row limit to 120.
  5. Run the query and verify the table preview shows 3 pages, with the last page containing at most 20 rows.
  6. Set Row limit to 10 and Server Page Length to 20.
  7. Run the query and verify the table preview shows at most 10 rows.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot Bot added the viz:charts:table Related to the Table chart label Jun 14, 2026
@bito-code-review

bito-code-review Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1e759e

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts - 1
    • Semantic pagination behavior change · Line 232-242
      The new logic now applies `rowLimit` (formData.row_limit) as a maximum cap across ALL pages, not just the final page. This is a meaningful behavior change: in the original code, pages 0-8 of 10 pages would each fetch pageSize rows, then page 9 would be capped. With this change, page 1 of 10 already returns 0 rows since page 0 consumed the 10-row cap. While mathematically correct for respecting rowLimit, this may change expected pagination behavior for users who rely on seeing multiple pages of results up to rowLimit.
Review Details
  • Files reviewed - 1 · Commit Range: f64b1ae..f64b1ae
    • superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
  • 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

AI Code Review powered by Bito Logo

const remainingRows =
rowLimit > 0 ? Math.max(rowLimit - rowOffset, 0) : pageSize;

moreProps.row_limit =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Architect Review — HIGH

When server pagination is enabled, the filter-change reset block persists the dynamic, last-page-capped queryObject.row_limit into ownState.pageSize, so if an external filter changes while the user is on the final page, the server pagination page size silently shrinks to the remainder instead of staying at the user-selected/server_page_length value.

Suggestion: Decouple "selected page size" from the per-request row_limit: on filter-change reset, set pageSize back to the configured server page length or the existing ownState.pageSize, and only apply the remaining-rows cap to queryObject.row_limit when building the query so that ownState.pageSize is never overwritten with a remainder-sized value.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
**Line:** 240:276
**Comment:**
	*HIGH: When server pagination is enabled, the filter-change reset block persists the dynamic, last-page-capped `queryObject.row_limit` into `ownState.pageSize`, so if an external filter changes while the user is on the final page, the server pagination page size silently shrinks to the remainder instead of staying at the user-selected/server_page_length value.

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.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
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

@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current implementation in the diff incorrectly calculates moreProps.row_limit using Math.min(pageSize, remainingRows), which effectively overwrites the intended page size with a smaller value when the user is on the final page. To resolve this, you should decouple the pageSize used for pagination from the row_limit applied to the query.

Here is the corrected implementation:

      const pageSize = Number(ownState.pageSize ?? formDataCopy.server_page_length) || 0;
      const currentPage = Number(ownState.currentPage) || 0;
      const rowOffset = currentPage * pageSize;
      const rowLimit = Number(formDataCopy.row_limit) || 0;

      moreProps.row_limit = rowLimit > 0 ? Math.min(pageSize, Math.max(rowLimit - rowOffset, 0)) : pageSize;
      moreProps.row_offset = rowOffset;

This ensures moreProps.row_limit is capped by the remaining rows without modifying the pageSize state itself. There are no other comments on this PR to address.

superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts

const pageSize = Number(ownState.pageSize ?? formDataCopy.server_page_length) || 0;
      const currentPage = Number(ownState.currentPage) || 0;
      const rowOffset = currentPage * pageSize;
      const rowLimit = Number(formDataCopy.row_limit) || 0;

      moreProps.row_limit = rowLimit > 0 ? Math.min(pageSize, Math.max(rowLimit - rowOffset, 0)) : pageSize;
      moreProps.row_offset = rowOffset;

Comment on lines +237 to +241
const remainingRows =
rowLimit > 0 ? Math.max(rowLimit - rowOffset, 0) : pageSize;

moreProps.row_limit =
rowLimit > 0 ? Math.min(pageSize, remainingRows) : pageSize;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: When rowOffset exceeds row_limit, remainingRows becomes 0 and the new logic assigns moreProps.row_limit = 0. In Superset query objects, row_limit: 0 means "no limit", not "return zero rows", so this can accidentally remove the cap and return rows beyond the configured row limit. Clamp the page/offset to a valid range or handle the zero-remaining case without emitting an unlimited row_limit. [logic error]

Severity Level: Major ⚠️
- ❌ Table server pagination can bypass configured row limit cap.
- ⚠️ Extra rows increase query load and confuse chart users.
Steps of Reproduction ✅
1. Render a Table chart with server pagination enabled so form data includes
`server_pagination: true` and `server_page_length`, as wired in
`superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx:383-405`. The chart is
rendered by `TableChart.tsx` which passes `serverPaginationData` (taken from
`chartProps.ownState`, see `transformProps.ts:499` and `transformProps.ts:778-790`) into
the `DataTable` component.

2. Navigate to a later page using the server-side pagination controls. Clicking a page in
the pagination UI calls `onServerPaginationChange`, which in Table charts is implemented
by `handleServerPaginationChange` in `TableChart.tsx:1458-1466` to update
`ownState.currentPage` and `ownState.pageSize` via `updateTableOwnState`. The next query
run uses this persisted `ownState` as `options.ownState` when `buildQuery` in
`buildQuery.ts` is invoked.

3. While on a later page, lower the chart Row limit to a value smaller than the current
offset (e.g. previously `row_limit = 1000`, `server_page_length = 50`, `currentPage = 4`,
then change `row_limit` to `10` and rerun). There is no code that resets `currentPage` on
row-limit changes: `cachedBuildQuery` in `buildQuery.ts:267-279` only resets
`row_offset`/`currentPage` when filters change, and `TableChart.tsx` only resets
`currentPage` on server page length changes (`useEffect` at `TableChart.tsx:31-38`) or
search changes (`handleSearch` at `TableChart.tsx:74-80`). Thus
`options.ownState.currentPage` can remain > new last page when the new query is built.

4. On the next data load, `buildQuery` computes the main page query with the stale
`currentPage`. In `buildQuery.ts:231-243`, it derives `pageSize` and `rowOffset` from
`ownState` and server page length, then calculates:

   - `rowOffset = currentPage * pageSize`

   - `rowLimit = Number(formDataCopy.row_limit) || 0`

   - `const remainingRows = rowLimit > 0 ? Math.max(rowLimit - rowOffset, 0) : pageSize;`
   (line 237)

   - `moreProps.row_limit = rowLimit > 0 ? Math.min(pageSize, remainingRows) : pageSize;`
   (line 241)

   When `rowOffset >= rowLimit` (e.g. `row_limit = 10`, `pageSize = 50`, `currentPage =
   2`, so `rowOffset = 100`), `remainingRows` becomes `0`, and `moreProps.row_limit` is
   set to `0`. In Superset query objects a `row_limit` of `0` is used as "no limit" / "all
   records" (see the same file's extra queries with `row_limit: 0` at
   `buildQuery.ts:113-120` and the test expectation in
   `plugins/plugin-chart-table/test/buildQuery.test.ts:18-26` for
   `percent_metric_calculation: 'all_records'`). Thus this path emits a main data query
   with `row_offset > 0` and `row_limit = 0`, effectively removing the chart row limit cap
   for that request and allowing more than the configured `row_limit` rows to be returned.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
**Line:** 237:241
**Comment:**
	*Logic Error: When `rowOffset` exceeds `row_limit`, `remainingRows` becomes `0` and the new logic assigns `moreProps.row_limit = 0`. In Superset query objects, `row_limit: 0` means "no limit", not "return zero rows", so this can accidentally remove the cap and return rows beyond the configured row limit. Clamp the page/offset to a valid range or handle the zero-remaining case without emitting an unlimited `row_limit`.

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
👍 | 👎

@codecov

codecov Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.62%. Comparing base (6d08e79) to head (da60ea1).
⚠️ Report is 151 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (6d08e79) and HEAD (da60ea1). Click for more details.

HEAD has 9 uploads less than BASE
Flag BASE (6d08e79) HEAD (da60ea1)
javascript 10 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41024      +/-   ##
==========================================
- Coverage   64.31%   55.62%   -8.69%     
==========================================
  Files        2652     2652              
  Lines      144799   144810      +11     
  Branches    33415    33423       +8     
==========================================
- Hits        93122    80550   -12572     
- Misses      50016    63533   +13517     
+ Partials     1661      727     -934     
Flag Coverage Δ
javascript 68.46% <100.00%> (+<0.01%) ⬆️
mysql ?
postgres ?
sqlite ?
unit ?

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.

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jun 16, 2026
@bito-code-review

Copy link
Copy Markdown
Contributor

Code Review Agent Run #e0ff53

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: f64b1ae..139904f
    • superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM — clamping row_limit to the remaining rows inside the user's row_limit is the right fix, and the Number(...) || 0 guards read well. Thanks for the two buildQuery tests covering both the lower-limit and remaining-rows cases. Happy to merge once CI's green.

Address two issues in the server-pagination row-limit capping:

- Pages beyond the row limit made remainingRows 0, so row_limit collapsed
  to 0, which the backend treats as 'no limit' and returns all rows. Clamp
  the requested page to the last one within the limit so the cap holds.
- On filter-change reset, ownState.pageSize was persisted from the capped
  per-request row_limit, silently shrinking page size on the last page.
  Persist the user-selected page size instead.

Co-Authored-By: Claude <[email protected]>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jun 23, 2026
@rusackas

Copy link
Copy Markdown
Member

Thanks @innovark37! Circled back because the codeant bot flagged a couple things, and it was actually right on both this time.

When the requested page sits past the configured row limit, remainingRows hits 0 and row_limit collapses to 0, which the backend reads as "no limit" (if row_limit: in helpers.py), so it'd quietly return the whole table instead of capping. And the filter-reset block was persisting that capped per-request limit into pageSize, so changing a filter on the last page silently shrank the page size.

I pushed a fix to clamp the page to the last one inside the limit and persist the user-selected page size instead, plus a test for the row_limit:0 case. Left the rest of your logic intact. Should be good once CI's green, but holler if you'd rather take a different tack on the clamp.

@netlify

netlify Bot commented Jun 23, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 67ce748
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a39fe7f251ebc0007aa1de6
😎 Deploy Preview https://deploy-preview-41024--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +246 to +251
const remainingRows =
rowLimit > 0 ? Math.max(rowLimit - rowOffset, 0) : pageSize;

moreProps.row_limit =
rowLimit > 0 ? Math.min(pageSize, remainingRows) : pageSize;
moreProps.row_offset = rowOffset;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: row_limit is now page-dependent, but when cached filters change the code only resets row_offset to 0 and does not recompute row_limit. If the user was on a capped last page (for example row_limit=120, pageSize=50, page 3 -> row_limit=20), the reset query for page 1 will still request only 20 rows instead of 50. Recompute row_limit after forcing offset/page reset (or rebuild pagination props using page 0) so first-page fetch size is correct after filter changes. [logic error]

Severity Level: Major ⚠️
- ⚠️ First page after filter changes returns fewer rows.
- ⚠️ Table chart server pagination inconsistent with configured page size.
Steps of Reproduction ✅
1. Open or create a Table chart that uses the Table plugin (registered in
`superset-frontend/plugins/plugin-chart-table/src/index.ts:19-61`) and enable server
pagination in the control panel (`server_pagination` and `server_page_length` controls in
`src/controlPanel.tsx:383-407`).

2. Configure a `row_limit` that is not a multiple of the server page length, for example
`row_limit = 120` and `server_page_length = 50`. Load data and navigate to the last server
page via the table pagination UI, which updates `ownState.currentPage` through
`handleServerPaginationChange` in `src/TableChart.tsx:24-32` by calling
`updateTableOwnState` with `currentPage` set to the selected page.

3. With the chart currently on that last page (so the previous request used `row_offset =
100` and a capped `row_limit = 20` computed in `buildQuery` at
`src/buildQuery.ts:231-251`), change an external filter (e.g., a dashboard filter or
cross-filter) so that `queryObject.filters` differs from the cached filters stored via
`setCachedChanges` (`src/buildQuery.ts:51-54` and the closure in `cachedBuildQuery` at
`src/buildQuery.ts:124-141`).

4. When the new request is built, `buildQuery` recomputes `moreProps` using the stale
`ownState.currentPage` (still pointing at the last page) and sets `moreProps.row_limit =
20` and `moreProps.row_offset = 100` (`src/buildQuery.ts:241-251`). The subsequent
filter-change block (`src/buildQuery.ts:96-103`) only overrides `row_offset` back to `0`
and does not recompute `row_limit`, so the first-page query after the filter change is
sent with `row_limit = 20` instead of the expected full page size `50`, yielding an
incorrectly short first page.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
**Line:** 246:251
**Comment:**
	*Logic Error: `row_limit` is now page-dependent, but when cached filters change the code only resets `row_offset` to 0 and does not recompute `row_limit`. If the user was on a capped last page (for example `row_limit=120`, `pageSize=50`, page 3 -> `row_limit=20`), the reset query for page 1 will still request only 20 rows instead of 50. Recompute `row_limit` after forcing offset/page reset (or rebuild pagination props using page 0) so first-page fetch size is correct after filter changes.

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
👍 | 👎

…ination

The filter-change reset zeroed row_offset but kept the last page's capped
row_limit, so the first page after a filter change fetched fewer rows than
the configured page size. Restore the full first-page row_limit on reset.

Also export buildQuery for direct testing and add coverage for the full
server-pagination/row-limit matrix: user limit below page size, capped last
page, pages clamped past the limit (no row_limit: 0), first-page restore and
page-size persistence on filter reset, and the no-row-limit fallback.

Co-Authored-By: Claude <[email protected]>
@rusackas

Copy link
Copy Markdown
Member

Yeah, the bot caught a third real one, same root cause: on a filter reset we zeroed the offset but kept the last page's capped row_limit, so the first page after a filter change came back short. Fixed it to restore the full first-page limit.

Rather than keep whacking these one at a time, I exported buildQuery and added tests across the whole matrix, user limit under the page size, capped last page, paging past the limit (no more row_limit:0), the first-page restore plus page-size persistence on reset, and the no-row-limit fallback. That should have the row-limit/pagination interactions pinned down now. Green locally, holler if you spot a case I missed.

@rusackas

Copy link
Copy Markdown
Member

Now that this has my fingerprints all over it, let me know your thoughts, I don't want to just randomly merge my own work. Adding @sadpandajoe for another pair of eyes here.

@rusackas
rusackas requested a review from sadpandajoe June 23, 2026 05:11

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #f34659

Actionable Suggestions - 2
  • superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts - 2
    • Large duplicated code block (204 tokens) · Line 57-57
    • Small duplicated code block (72 tokens) · Line 230-230
Review Details
  • Files reviewed - 2 · Commit Range: 139904f..da60ea1
    • superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
    • superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
  • 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

AI Code Review powered by Bito Logo

}

const buildQuery: BuildQuery<TableChartFormData> = (
export const buildQuery: BuildQuery<TableChartFormData> = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large duplicated code block (204 tokens)

Code duplication detected: 31 lines of buildQuery implementation are duplicated between plugin-chart-table/src/buildQuery.ts (lines 57-87) and plugin-chart-ag-grid-table/src/buildQuery.ts (lines 61-91). Additional similar duplications exist at lines 182-221, 230-244, and 278-290 in plugin-chart-table and corresponding lines in plugin-chart-ag-grid-table. Consider extracting the common buildQuery logic into a shared utility module.

Code Review Run #f34659


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

const firstPageRowLimit =
configuredRowLimit > 0
? Math.min(pageSize, configuredRowLimit)
: pageSize;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small duplicated code block (72 tokens)

Duplicate code identified: 15 lines of ownState handling and isDownloadQuery detection logic duplicated between plugin-chart-table/src/buildQuery.ts (lines 230-244) and plugin-chart-ag-grid-table/src/buildQuery.ts (lines 205-219). This is part of a larger pattern of duplication in these buildQuery implementations.

Code Review Run #f34659


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@rusackas

Copy link
Copy Markdown
Member

I think the CodeAnt logic comments here are already handled by your last couple commits (the lastPage clamp and recomputing firstPageRowLimit on reset). The bot also flagged the buildQuery duplication with plugin-chart-ag-grid-table, which turns out to have the exact same row-limit bug, so I ported your fix over there in #41346. LGTM!

@rusackas
rusackas merged commit c1d08bf into apache:master Jun 23, 2026
66 checks passed
shantanukhond pushed a commit to shantanukhond/superset that referenced this pull request Jun 24, 2026
@innovark37
innovark37 deleted the innovark/fix/table-server-pagination-row-limit branch July 1, 2026 06:24
rusackas added a commit that referenced this pull request Jul 7, 2026
Ports the server-pagination row-limit fix from plugin-chart-table (#41024)
to the ag-grid table, which shared the same buildQuery logic and therefore
the same bugs:

- Paging past the configured row limit produced `row_limit: 0`, which the
  backend treats as "no limit" rather than "no rows" — silently removing the
  cap and returning more rows than configured. The page is now clamped to the
  last page that still falls within the limit, and per-page `row_limit` is
  capped to the remaining rows.
- On a filter-change reset the per-request (last-page-capped) `row_limit` was
  persisted into `ownState.pageSize`, shrinking the page size. The reset now
  restores the full first-page `row_limit` and persists the user-selected page
  size.

Adds unit tests mirroring the plugin-chart-table coverage.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants