TanStackT
TanStack2y ago
2 replies
sacred-rose

isAllRowsExpanded - how to make that work with managing expanded state?

My issue is i want grouping to auto expand. There is a clear flicker when i use this mechanic to do so:

    useLayoutEffect(() => {
        if (grouping.length > 0) {
            toggleAllRowsExpanded(true);
        }
    }, [grouping, toggleAllRowsExpanded]);


So, i figured I'd switch to managing my own expanded state by passing props, expanded and onExpandedChange. However, the state isAllRowsExpanded is not reflecting the correct value in this method. when i collapse / expand all rows manually, its not getting updated per my desire/expectation. How can i solve both of these problems?

If there are better suggestions for the initial problem of auto expanding rows without managing your own expanded state, let me know.
Was this page helpful?