NoiceHax opened a new pull request, #43150: URL: https://github.com/apache/superset/pull/43150
DataTable returned early when it had no columns, but five hooks (the mounted ref and its effect, the RAF and signature refs, and the effect that emits filtered rows through onFilteredRowsChange) were declared about 130 lines below that return. A table chart whose query result moves between a columns-less and a populated result therefore changed its hook count between renders, so React threw "Rendered fewer/more hooks than expected" and the chart unmounted to an error boundary. Move those five hooks above the early return and lift stableRowKey, hashString and signatureOfRows to module scope; no hook body, dependency array or emit condition changes. ## Testing New file superset-frontend/plugins/plugin-chart-table/test/DataTable/DataTable.test.tsx with two tests that render DataTable inside a class error boundary and rerender across the column-count boundary in both directions (N columns -> 0, and 0 -> N), asserting no render-phase throw and that the expected content renders. Follows the existing error-boundary-in-test precedent from plugins/plugin-chart-calendar/test/ReactCalendar.test.tsx and includes the ASF license header. Tests are included but I was not able to execute the suite locally (environment not available); please rely on CI. Closes #42978 -- 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]
