React-table: An expanded rows expanded state is only tied to the row index

Created on 15 Jul 2019  路  3Comments  路  Source: tannerlinsley/react-table

V7
When using expanded rows and sorting together the state of the expanded row isn't tied to the exact row just the index.

An example and steps to replicate shown below:
Grouping by age and expanding the age equal to 0 as shown below

Age   | Name  
v 0   |
鈹溾攢 0  |  Peter
鈹斺攢 0  |  John
> 1   |

Then sorting by name causes the rows to reorder as expected however now the age group equal to 1 is expanded whereas the age group 0 is expected to be expanded.
Actual:

Age   |  Name
v 1   |
鈹溾攢 1  |  Alex
鈹斺攢 1  |  Bob
> 0   |

Expected:

Age   |  Name
> 1   |
v 0   |
鈹溾攢 0  |  Peter
鈹斺攢 0  |  John

This can be tested in the sandbox demo here by following the steps mentioned above.

bug

Most helpful comment

Indeed, useExpanded is using the materialized row index, and not the original index to track expanded state. This should be fixed in the next alpha release 馃憤.

All 3 comments

I'll take a look into this.

Indeed, useExpanded is using the materialized row index, and not the original index to track expanded state. This should be fixed in the next alpha release 馃憤.

This is fixed in the latest alpha release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tremby picture tremby  路  3Comments

williamolojede picture williamolojede  路  3Comments

ocalde picture ocalde  路  3Comments

dilipsundarraj1 picture dilipsundarraj1  路  3Comments

pasichnyk picture pasichnyk  路  3Comments