bikash-barnwal opened a new pull request, #43194:
URL: https://github.com/apache/superset/pull/43194
### SUMMARY
With server pagination on and a result set smaller than the configured page
size, the page-size selector rendered `0` and the configured size disappeared
from the dropdown.
Two connected defects:
1. **`TableChart.tsx:465`** filtered every server option by the row count:
```ts
const getServerPagination = (n: number) => n <= rowCount;
```
With `rowCount = 12` and `SERVER_PAGE_SIZE_OPTIONS = [10, 20, 50, 100,
200]`, the list collapses to `[10]` — the configured size (say 20) is gone.
2. **`DataTable/DataTable.tsx:464-469`** then cannot find the active size
among those options, so `findIndex` returns `-1` and it falls back to `0`:
```ts
if (foundPageSizeIndex === -1) { resultCurrentPageSize = 0; }
```
`0` is the *client* option list's "All" sentinel and is not a valid
server page size, so the select receives a value with no matching option and
renders empty.
The fix keeps the size actually being paginated with selectable (`n <=
rowCount || n === currentServerPageSize`), and changes the `-1` fallback to
clamp to the largest available option instead of `0`, leaving the value
untouched when the options list is empty.
Note for reviewers: this does not overlap #43184, which hoists hooks near
the top of `DataTable.tsx`; this change is inside the `if (serverPagination)`
block further down.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: page-size selector shows `0`, dropdown offers only `10`.
After: the configured size stays selected and available.
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
npm run test -- plugins/plugin-chart-table
```
New test `keeps the configured page size when rowCount is smaller (#42243)`.
Before the fix: **1 failed, 146 passed**. After: **147 passed across 7 suites**
(verified in a clean checkout, not just the authoring worktree).
Manually: a Table chart with server pagination enabled, page size 20,
against a query returning ~12 rows — the selector should read 20, not 0.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #42243
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
🤖 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]