Help figuring out why queryFn is firing with stale params
Consider this snippet from a "Widget" component:
This works fine, but I'd like a way to invalidate all widgets at some point, so I added a 'widget' string to my queryKey:
For some strange reason, when queryParams changes, the queryFn() will now run twice, once with the old queryParams and once with the new queryParams. I can't for the life of me understand why. Can anyone provide insight? I've already logged out queryParams to verify a sneaky re-render with old data isn't happening - so im confident its something going on with useQuery
1 Reply
genetic-orangeOP•2mo ago
Also, i do not have StrictMode enabled