Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent expanded React-Table row from collapsing on re-render?

I have a simple react-table with an expanded sub component whose data is tied to a Redux state object.

When the sub component gets expanded, I trigger an api call to get some additional data to be lazy-loaded onto the redux store. The redux store gets updated with the new data and the sub component DOM gets successfully updated as well, but the problem is the expanded row doesn't stay expanded after the re-render. It collapses.

Is there a way to keep my expanded rows expanded even after the redux store gets updated and a re-render is triggered?

like image 570
LCIII Avatar asked Feb 14 '20 14:02

LCIII


1 Answers

Set autoResetExpanded to false in configuration, more details - https://react-table.tanstack.com/docs/api/useExpanded

like image 164
Rohit Garg Avatar answered Sep 19 '22 15:09

Rohit Garg