v7: changes to flexRender causes component remount
See original GitHub issueIn https://github.com/tannerlinsley/react-table/commit/4f13f3202398c05d642c9f03dc03046aaa7a105b the definition of flexRender changed and you stopped passing props to certain function components. This in turn causes components to be recreated when they don’t need to be, in turn causing them to start off with their initial state values.
Specifically I’m seeing this in a cell renderer, implemented as a callback (wrapped by useCallback) that returns a button-menu, that in turn references table state.
As an aside, this same change also blocks defining renderers as raw JSX.
i.e.
you used to be able to define a Column with something like:
Header: <Trans>Name</Trans>
now you must define them as:
Header: () => <Trans>Name</Trans>
I could live with the second side effect, it was a bit wordy, but harmless, the former problem is a blocker.
I’ve tested that simply reverting the change to this function appears to work in general, and specifically fixes my problem.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (8 by maintainers)
Can you point me to a sandbox with an example? That will help me hack on this with you.
Awesome! Good to hear.