-
-
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
add reset
method to useMutation hook
#1476
Conversation
✔️ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: 6d09682 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/6144ef096362f000071c68e3 😎 Browse the preview: https://deploy-preview-1476--redux-starter-kit-docs.netlify.app |
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 6d09682:
|
Is there no need to update query results using same tags? |
@taejs after just clearing a mutation result? That does not mean the mutation has run again or anything was sent to the server, it just means the component does not want to display the result anymore |
when is this gonna be available? @phryneas |
@LhonRafaat next minor release. Could still be a month or two, given what else we want in there. In the meantime you can either use the CodeSandbox build linked above or do something like const lastMutation = useRef(undefined)
const [trigger] = useMyMutation()
// when triggering:
lastMutation.current = trigger(arg);
// to reset
lastMuation.current.unsubscribe() |
@phryneas the spelling & wording threads are still open, but besides that, LGTM! |
Co-authored-by: Shrugsy <joshfraser91@gmail.com>
This would resolve #1455.
Also, it eliminiates all
useRef
usages in theuseMutation
hook, which is probably not a bad thing.