Skip to content

Commit a12edba

Browse files
committed
useMutation: use useIsomorphicLayoutEffect instead of useLayoutEffect
1 parent a739dfd commit a12edba

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/clean-icons-sparkle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
`useMutation`: use `useIsomorphicLayoutEffect` instead of `useLayoutEffect`

.size-limits.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"dist/apollo-client.min.cjs": 39561,
2+
"dist/apollo-client.min.cjs": 39579,
33
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32821
44
}

src/react/hooks/useMutation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { equal } from "@wry/equality";
2020
import { DocumentType, verifyDocumentType } from "../parser/index.js";
2121
import { ApolloError } from "../../errors/index.js";
2222
import { useApolloClient } from "./useApolloClient.js";
23+
import { useIsomorphicLayoutEffect } from "./internal/useIsomorphicLayoutEffect.js";
2324

2425
/**
2526
*
@@ -99,7 +100,7 @@ export function useMutation<
99100
options,
100101
});
101102

102-
React.useLayoutEffect(() => {
103+
useIsomorphicLayoutEffect(() => {
103104
Object.assign(ref.current, { client, options, mutation });
104105
});
105106

0 commit comments

Comments
 (0)