diff --git a/.changeset/wet-shirts-juggle.md b/.changeset/wet-shirts-juggle.md new file mode 100644 index 00000000000..83b13283173 --- /dev/null +++ b/.changeset/wet-shirts-juggle.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Fix missing `getServerSnapshot` error when using `useSubscription` on the server. diff --git a/.size-limits.json b/.size-limits.json index 7198e88e42e..6f43705ee6e 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 40164, + "dist/apollo-client.min.cjs": 40168, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32974 } diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index fc2280c7bfb..94037c319bd 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -301,7 +301,8 @@ export function useSubscription< () => observable && !skip && !ignoreResults ? observable.__.result - : fallbackResult + : fallbackResult, + () => fallbackResult ); return React.useMemo( () => ({