You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to add a hook that allows modifying initialState within a plugin.
For example, I've been wanting to build a useQueryStringTableState plugin which will store the table's state in the query string and restore table state from the query string on reload. The intention of this being to enable sharing/bookmarking links with certain sorting etc.
Writing a plugin using the stateReducer hook doesn't work well. Once data is loaded, all of the reset* methods will be called to reset each value. But disabling the auto reset options isn't ideal for when the data changes in a more tangible way (e.g. filtering options changing).
For the time being I've worked around this by writing a plugin to store the data, and a separate React Hook to retrieve the items like so:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It would be great to add a hook that allows modifying
initialState
within a plugin.For example, I've been wanting to build a
useQueryStringTableState
plugin which will store the table's state in the query string and restore table state from the query string on reload. The intention of this being to enable sharing/bookmarking links with certain sorting etc.Writing a plugin using the
stateReducer
hook doesn't work well. Oncedata
is loaded, all of thereset*
methods will be called to reset each value. But disabling the auto reset options isn't ideal for when thedata
changes in a more tangible way (e.g. filtering options changing).For the time being I've worked around this by writing a plugin to store the data, and a separate React Hook to retrieve the items like so:
But that requires a separate hook and the user to be using both the hook & plugin correctly
Beta Was this translation helpful? Give feedback.
All reactions