-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
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
- 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.
Environment
node: 16.19.0
figbird: 0.11.1
React: 18.2.0
vite: 4.0.0
Usage
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.
Metadata
Metadata
Assignees
Labels
No labels