-
First of all, apologies if this is naive question. App is using NextJs, React-QueryJs, RecoilJs (state-management). ISSUE: When I locally update a state within recoil-js, the update flashes on screen before it disappears. I suspect this is because React-query overwrites the recoil-js state with its own cached values (which doesnt have the new locally updated changes). DETAILS: When a mutation is triggered from within a component (eg. user updates a task), I use the mutation response to update the relevant recoil-js state. To fix this, I would have to either:
Would appreciate insight as to whats the correct way to resolve this. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
it seems like you're mixing server state and client state here. Why would you need to update recoil state after the mutation? I would need to see some code, but generally, I would say that after a mutation, you would want to update a query, which you can either do with invalidation (refetch), or via updates from mutation responses. |
Beta Was this translation helpful? Give feedback.
it seems like you're mixing server state and client state here. Why would you need to update recoil state after the mutation? I would need to see some code, but generally, I would say that after a mutation, you would want to update a query, which you can either do with invalidation (refetch), or via updates from mutation responses.