You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the useMutation hook and I am experiencing an issue where the hook does not update the hook state after the first API request, and it does update it after subsequent API requests but with the previous call's result.
Steps to Reproduce
Import the useMutation hook from figbird into a React component
Call the patch() from hook in the component and observe that the state is not updated
Call it again without refreshing and observe that the state is updated
Expected Behavior
The useMutation hook should update the state after each API request.
Actual Behavior
The useMutation hook only updates the state after subsequent API requests with the previous API request's response, and not after the first API request.
const { patch, status, error } = useMutation(SERVICE);
patch(id, payload);
console.log("status, error ",status, error );
// returns the null, idle after the first call, but changes in the second call
Additional Information
The same thing works perfectly in useGet and useFind hooks.
The text was updated successfully, but these errors were encountered:
ingeniousambivert
changed the title
useMutation doesn't update error/status state during the first mutation call
useMutation doesn't update state during the first mutation call
Jan 31, 2023
Description
I am using the
useMutation
hook and I am experiencing an issue where the hook does not update the hook state after the first API request, and it does update it after subsequent API requests but with the previous call's result.Steps to Reproduce
useMutation
hook from figbird into a React componentpatch()
from hook in the component and observe that the state is not updatedExpected Behavior
The
useMutation
hook should update the state after each API request.Actual Behavior
The
useMutation
hook only updates the state after subsequent API requests with the previous API request's response, and not after the first API request.Environment
node: 16.19.0
figbird: 0.11.1
React: 18.2.0
vite: 4.0.0
Usage
Additional Information
The same thing works perfectly in
useGet
anduseFind
hooks.The text was updated successfully, but these errors were encountered: