Replies: 2 comments 2 replies
-
Just a hunch - It seems like the cached object returned from the query is different, it has all the same data, but it seems to be a new object with a new reference which may be the cause of this. 🤷🏻♂️ |
Beta Was this translation helpful? Give feedback.
1 reply
-
interesting. I think it might be a bug in I also updated to v4, where this issue also persists: https://codesandbox.io/s/sad-scott-cidk6s?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the Bug
After switching between 1 & 2 for couple of times (so that react query caches data for each of them), the useEffect still triggers twice.
The expected behavior is seen till v3.8.3 i.e. useEffect only triggers once. Once react query is updated to v3.9.0 every click on 1 or 2 causes useEffect to trigger twice.
Is there a way to prevent the second trigger?
I found related issues but still wanted some more info. if possible.
Minimal, reproducible example
https://codesandbox.io/s/optimistic-firefly-1tk7i5
Steps to reproduce
Click in 1 > Click on 2 > Click in 1 > Click on 2
Expected behavior
useEffect to trigger only once when
id
is switched.How often does this bug happen?
Always
Beta Was this translation helpful? Give feedback.
All reactions