Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memoize update function of useQueryState in a way that it doesn't go stale #1

Open
dongyeop-youha opened this issue Nov 16, 2022 · 0 comments

Comments

@dongyeop-youha
Copy link
Contributor

Currently, update function returned from useQueryState is changed when its behavior is changed (when key, history, serializers option is changed in runtime).

This causes previous returned function to go stale, and it should not be used if any of those options are changed.

If those options are persisted inside the hook with a useRef, and the update function accesses it, update function would not have to change and it won't ever become stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant