-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: api.util.resetApiState should reset useQuery hooks #1735
Conversation
size-limit report 📦
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3d47bbe:
|
@phryneas Tried this fix with my app and I can confirm that hooks are getting reset by looking at the placeholder components. I'll also generate a small example to confirm that all hooks are getting reset or not. |
Hmm you're right, that is not really optimal behaviour. I'll have to look into that tomorrow, but that could be tricky. |
@ayushsharma82 I think this should do it, but I'll have to reread that tomorrow. Your test seems to pass now - can you experiment a bit more with that please? |
Sure, I'll add some more steps to that demo. |
Works! ( https://codesandbox.io/s/reduxjs-redux-toolkit-forked-qu9n6?file=/src/App.tsx ) Added a 'hide' button to simulate query being removed and added again before/after dispatching |
Is this statement in docs still relevant or should it be removed?
|
This should provide a fix for #1725.
@ayushsharma82 could you please try this? In a few minutes, the CodeSandbox bot should comment on this issue and one of the links there should lead to installation instructions for this build.