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

   ### SUMMARY
   
   Follow-up to #41024, which fixed server-pagination row-limit handling in 
`plugin-chart-table`. The `plugin-chart-ag-grid-table` plugin carries a 
near-identical `buildQuery` implementation and therefore has the **same two 
bugs**, still present on master:
   
   ```js
   // plugin-chart-ag-grid-table/src/buildQuery.ts (before)
   const pageSize = ownState.pageSize ?? formDataCopy.server_page_length;
   const currentPage = ownState.currentPage ?? 0;
   moreProps.row_limit = pageSize;
   moreProps.row_offset = currentPage * pageSize;
   ```
   
   1. **Row-limit cap bypass.** When the page offset exceeds the configured 
`row_limit`, the remaining-rows math collapses `row_limit` to `0`, which the 
backend (`helpers.py get_sqla_query`) treats as **"no limit"** rather than "no 
rows" — silently returning more rows than the configured limit. The page is now 
clamped to the last page that still falls within the limit, and the per-page 
`row_limit` is capped to the remaining rows.
   2. **Page size shrink on filter reset.** On a filter-change reset, the 
per-request (last-page-capped) `row_limit` was persisted into 
`ownState.pageSize`, shrinking the user's page size. The reset now restores the 
full first-page `row_limit` and persists the user-selected page size.
   
   The fix mirrors #41024 exactly so the two table implementations stay in 
sync. (A shared `buildQuery` utility between the two plugins — as noted by bot 
review on #41024 — would be a worthwhile separate refactor.)
   
   ### TESTING INSTRUCTIONS
   
   Added unit tests to `plugin-chart-ag-grid-table/test/buildQuery.test.ts` 
mirroring the plugin-chart-table coverage. All 6 pass locally:
   
   ```bash
   cd superset-frontend
   npx jest plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts -t 
"server pagination row limit"
   ```
   
   Covers: user row limit lower than page size, remaining-rows capping on the 
last page, page-beyond-limit clamping (no `row_limit: 0`), first-page row-limit 
restore after filter reset, page-size persistence on reset, and the 
no-row-limit fallback.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Related: #41024
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to