Skip to content

Commit 185c889

Browse files
committed
More thorough test
1 parent ac38202 commit 185c889

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/react/hooks/__tests__/useMutation.test.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -3414,19 +3414,19 @@ describe.skip("Type Tests", () => {
34143414
expectTypeOf(result).toMatchTypeOf<{ reset: () => void }>();
34153415
expectTypeOf(result).not.toMatchTypeOf<MutationResult<Mutation>>();
34163416
expectTypeOf(mutate()).toMatchTypeOf<Promise<FetchResult<Mutation>>>();
3417-
const {
3418-
reset,
3419-
// @ts-expect-error
3420-
data,
3421-
// @ts-expect-error
3422-
loading,
3423-
// @ts-expect-error
3424-
error,
3425-
} = result;
3426-
reset;
3427-
data;
3428-
loading;
3429-
error;
3417+
// Available and reliable in the result
3418+
result.reset;
3419+
3420+
// @ts-expect-error
3421+
result.called;
3422+
// @ts-expect-error
3423+
result.client;
3424+
// @ts-expect-error
3425+
result.data;
3426+
// @ts-expect-error
3427+
result.error;
3428+
// @ts-expect-error
3429+
result.loading;
34303430
}
34313431

34323432
// Explicit `false`

src/react/hooks/useMutation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export function useMutation<
218218
return response;
219219
})
220220
.catch((error) => {
221+
// TODO: Should this be checking for ignoreResults?
221222
if (mutationId === ref.current.mutationId && ref.current.isMounted) {
222223
const result = {
223224
loading: false,

0 commit comments

Comments
 (0)