VinayaKumar12 opened a new pull request, #37517: URL: https://github.com/apache/superset/pull/37517
fix(charts): normalize server_page_length from string to number ### SUMMARY Fixes a backend type comparison error (`'<' not supported between instances of 'str' and 'int'`) that occurs when using custom server page length values in Table charts. The `SelectControl` component with `freeForm: true` stores user-typed values as strings. When `server_page_length` is manually entered (e.g., "99"), it's saved as a string but the Python backend expects a number for comparison operations. This PR adds type normalization in `exploreReducer.js` to convert `server_page_length` from string to number when the `SET_FIELD_VALUE` action is dispatched. The fix is targeted - only `server_page_length` is normalized, as other controls like `row_limit` don't exhibit this backend issue. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF **Before:** - Screenshot showing the error: "Error loading chart datasources. Filters may not work correctly." <img width="1920" height="1019" alt="image" src="https://github.com/user-attachments/assets/8b50f8fa-ecba-4e0b-ab74-4cf4ecd468cc" /> <img width="1916" height="1020" alt="image" src="https://github.com/user-attachments/assets/9045261b-bb3f-4597-b00d-f2be543c661a" /> - Backend console error: `TypeError: '<' not supported between instances of 'str' and 'int'` <img width="940" height="415" alt="image" src="https://github.com/user-attachments/assets/ac7eb46e-3368-4f78-a2db-9f0f3ab149e4" /> **After:** - Screenshot showing the chart loads successfully with custom server page length value <img width="1888" height="1022" alt="image" src="https://github.com/user-attachments/assets/637538a1-ed62-44b7-8528-145aec0e0cf0" /> <img width="1915" height="1016" alt="image" src="https://github.com/user-attachments/assets/6656c666-401b-4180-8007-09209dab1097" /> ### TESTING INSTRUCTIONS 1. Create or open a Table chart 2. In the "Data" tab, expand "Server Pagination" section 3. Enable "Server Pagination" toggle 4. Manually type a custom value in "Server Page Length" field (e.g., 99) 5. Click "Update Chart" 6. Verify the chart loads successfully without backend errors 7. Run unit tests: `cd superset-frontend && npm test -- exploreReducer.test.js` ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] 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 -- 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]
