T
TanStack13mo ago
like-gold

autoResetExpanded does not work as expected

Hey 👋🏽 @Tanner Linsley @KevinVandy autoResetExpanded should work in such a way that the expanding state is reset on a data change, right? I tried that, but it does not work. The data changes, but the expanded state remains. There's much confusion in the web about how to achieve a auto-reset of the expanded state in tanstack-table v8. The only way I can manage the expand-reset so far is the following:
useEffect(() => {
table.resetExpanded();
}, [data]);
useEffect(() => {
table.resetExpanded();
}, [data]);
Is this the right way? If yes, what's the purpose of https://tanstack.com/table/latest/docs/api/features/expanding#autoresetexpanded Thanks
3 Replies
like-gold
like-goldOP13mo ago
If autoReset*-features are obsolete, what is the correct way to achieve the same features?There's the useEffect approach, but the extra rendering rounds are not great. Would it be possible to have onDataChange-event?
judicial-coral
judicial-coral13mo ago
It's possible there was just a bug introduced here at some point, will need to look into it
like-gold
like-goldOP13mo ago
@KevinVandy ok, thanks for checking this.

Did you find this page helpful?