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

   ### SUMMARY
   Fixes #31403
   
   When using "View as Table" on a Mixed Chart, navigating to the last page and 
then searching for text not present in the table would cause a pagination error 
because the current page exceeds the available pages after filtering.
   
   **Root Cause:**
   `TableView` uses `react-table` internally and manages pagination state. When 
filtering reduces the data to fewer pages than the current page number, the 
internal state becomes invalid.
   
   **Fix:**
   Added automatic pagination reset to `TableView` when the current page 
exceeds available pages. This matches the existing behavior in `ListView` and 
handles the issue at the component level rather than requiring consumers to 
implement workarounds.
   
   ```tsx
   // Reset to first page when current page exceeds available pages
   useEffect(() => {
     if (
       withPagination &&
       !serverPagination &&
       !loading &&
       pageIndex > pageCount - 1 &&
       pageCount > 0
     ) {
       gotoPage(0);
     }
   }, [withPagination, serverPagination, loading, pageIndex, pageCount, 
gotoPage]);
   ```
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before: Error/unexpected behavior when searching after navigating to last 
page
   After: Pagination resets to page 1 when filtering reduces page count, no 
error
   
   ### TESTING INSTRUCTIONS
   1. Create or open a Mixed Chart (Mixed Time-Series) in Superset
   2. Click "View as Table" in the chart options menu  
   3. Navigate to the last page using pagination controls
   4. In the search box, type text that doesn't exist in the table
   5. Verify that no error occurs and the table shows "No results"
   6. Clear the search box and verify data returns to page 1
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #31403
   - [ ] Required feature flags: None
   - [x] Changes UI: Minor fix to table pagination behavior
   - [ ] Includes DB Migration: No
   - [ ] Introduces new feature or API: No
   - [ ] Removes existing feature or API: No
   
   🤖 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