File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,15 @@ export function useMutation(
6464 ...useConfigContext ( ) ,
6565 ...config ,
6666 } )
67+
68+ const getStatus = useGetLatest ( state . status )
6769
6870 const mutate = React . useCallback (
6971 async ( variables , options = { } ) => {
70- if ( ! [ statusIdle , statusSuccess , statusError ] . includes ( state . status ) ) {
72+ if ( ! [ statusIdle , statusSuccess , statusError ] . includes ( getStatus ( ) ) ) {
7173 return
7274 }
75+
7376 dispatch ( { type : actionMutate } )
7477
7578 const resolvedOptions = {
@@ -95,7 +98,7 @@ export function useMutation(
9598 }
9699 }
97100 } ,
98- [ getConfig , getMutationFn , state . status ]
101+ [ getConfig , getMutationFn , getStatus ]
99102 )
100103
101104 const reset = React . useCallback ( ( ) => dispatch ( { type : actionReset } ) , [ ] )
You can’t perform that action at this time.
0 commit comments