atomsWithQuery not updating when staleTime is used
#1778
Unanswered
gilmarsquinelato
asked this question in
General
Replies: 1 comment 1 reply
-
|
Thanks for reporting and a good reproduction!
Can anyone dig into it?? |
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
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, thank you for the amazing job you've done!
The situation I found was regarding
atomsWithQuerywhen used in conjunction withstaleTime.The issue is that the query atom doesn't update its dependencies/components when its data get stale.
An example is when fetching based on a selected user ID, the problem occurs when selecting an already loaded user ID, where the ID atom changes, but the selected user atom doesn't, so the components don't change as well.
I tested with react-query separately and it works perfectly, even if I use it with jotai but not the
atomsWithQuery, only the atoms to store the selected user id.The reproduction steps are:
The playground to reproduce: https://codesandbox.io/s/fast-https-f2p5g2?file=/src/App.js
Does anyone know why this is happening?
Is it expected or is it a bug?
Beta Was this translation helpful? Give feedback.
All reactions