Replies: 1 comment
-
show a minimal reproduction please because this shouldn't happen |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following hook to fetch user from database:
So the initialData are taken from localStorage (just user id) and full user data are fetched from database. The problem is that I use this hook in various components and the following issue arised:
useCurrentUser
query to fetch user. At that point all components that usesuseCurrentUser
are rerendered and entire page is resetted (dialog is closing as well).I added
staleTime: Infinity
and then there is no rerenders but the data is never fetched (alwasys initialData is taken). So I added the following to my global provider:and now it works and there is no rerenders (no refetching) - is that a proper solution or I can simplify it?
Beta Was this translation helpful? Give feedback.
All reactions