Replies: 3 comments 9 replies
-
Yeah, it's good.
So, React-Query does not invoke the queryFn -> onSuccess callback isn't fire. If you want to fire |
Beta Was this translation helpful? Give feedback.
-
It's actually split, the complex logic is process through The 'onSuccess' callback just call a specific action on the reducer for this useQuery, an for all others useQuery... The complex logic must be process when data is load (cache, no cache) for assets (query 1), for sub assets (query 2), for xyz (query 3..N) |
Beta Was this translation helpful? Give feedback.
-
It looks like you are "syncing" state from react-query with some other state management, which is generally a suboptimal pattern. I've recently written about this: https://tkdodo.eu/blog/react-query-as-a-state-manager What you'd usually want to do is just work with the
If you want to avoid calling a function on every render - that's what
this will only call the function if |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Thks for your work!
I'm wondering why useQuery doesn't trigger the onSuccess callback when the data are retrieved from the cache (with staleTime: 20s)?
I use onSuccess callback to update a reducer containing all the UI complexity based on multiple useQuery...
My code:
Beta Was this translation helpful? Give feedback.
All reactions