bikash-barnwal opened a new pull request, #43184:
URL: https://github.com/apache/superset/pull/43184

   ### SUMMARY
   
   `DataTable` returns early with a "No data found" placeholder when it has no 
columns (`DataTable.tsx:421`), but five hooks were declared *after* that 
return: the mounted ref, the RAF ref, the signature ref, and the two effects 
that emit filtered rows to the parent.
   
   Crossing the zero-column boundary in either direction therefore changes the 
hook count between renders, and React throws:
   
   ```
   Rendered more hooks than during the previous render
   ```
   
   which takes the whole chart down.
   
   The fix hoists that block above the early return so the hook list is 
unconditional. The row-signature helpers (`stableRowKey`, `hashString`, 
`signatureOfRows`) also move to module scope — they were being redeclared on 
every render, and reading the id-like fields from `row.original` at function 
scope required `any` casts that are no longer needed.
   
   Rendered output is unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable — crash fix, no visual change.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm run test -- plugins/plugin-chart-table/test/DataTable
   ```
   
   New tests cross the boundary in both directions and were confirmed to fail 
on unpatched source: **2 failed** before the change (`Rendered more hooks than 
during the previous render`), **5 passed** after.
   
   Manually: render a Table chart whose column set can empty out and repopulate 
(e.g. a query that returns no columns, then one that does) and confirm the 
chart recovers instead of crashing.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #42978
   - [ ] 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]

Reply via email to