Skip to content

Commit

Permalink
Merge branch 'release-3.8' of github.com:apollographql/apollo-client …
Browse files Browse the repository at this point in the history
…into release-3.8
  • Loading branch information
alessbell committed Jan 3, 2023
2 parents fa89269 + c357562 commit 98cacc9
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-birds-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Silence useLayoutEffect warning when useSuspenseQuery runs on server
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"changesets": [
"early-pens-retire",
"polite-birds-rescue",
"rude-mayflies-scream",
"sixty-trains-sniff",
"small-timers-shake"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @apollo/client

## 3.8.0-alpha.3

### Patch Changes

- [#10399](https://github.com/apollographql/apollo-client/pull/10399) [`652a1ae08`](https://github.com/apollographql/apollo-client/commit/652a1ae0868e4a5b75b9ff656d26f57eeca1081a) Thanks [@alessbell](https://github.com/alessbell)! - Silence useLayoutEffect warning when useSuspenseQuery runs on server

## 3.8.0-alpha.2

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion config/bundlesize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from "path";
import { gzipSync } from "zlib";
import bytes from "bytes";

const gzipBundleByteLengthLimit = bytes("33.17KB");
const gzipBundleByteLengthLimit = bytes("33.19KB");
const minFile = join("dist", "apollo-client.min.cjs");
const minPath = join(__dirname, "..", minFile);
const gzipByteLen = gzipSync(readFileSync(minPath)).byteLength;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/client",
"version": "3.8.0-alpha.2",
"version": "3.8.0-alpha.3",
"description": "A fully-featured caching GraphQL client.",
"private": true,
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/react/hooks/internal/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// These hooks are used internally and are not exported publicly by the library
export { useDeepMemo } from './useDeepMemo';
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
6 changes: 6 additions & 0 deletions src/react/hooks/internal/useIsomorphicLayoutEffect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { useLayoutEffect, useEffect } from 'react';
import { canUseLayoutEffect } from '../../../utilities/common/canUse';

export const useIsomorphicLayoutEffect = canUseLayoutEffect
? useLayoutEffect
: useEffect;
5 changes: 2 additions & 3 deletions src/react/hooks/useSuspenseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
useCallback,
useMemo,
useState,
useLayoutEffect,
} from 'react';
import { equal } from '@wry/equality';
import {
Expand All @@ -31,7 +30,7 @@ import {
SuspenseQueryHookOptions,
ObservableQueryFields,
} from '../types/types';
import { useDeepMemo } from './internal';
import { useDeepMemo, useIsomorphicLayoutEffect } from './internal';
import { useSuspenseCache } from './useSuspenseCache';
import { useSyncExternalStore } from './useSyncExternalStore';

Expand Down Expand Up @@ -309,7 +308,7 @@ function useObservableQueryResult<TData>(observable: ObservableQuery<TData>) {
//
// Unlike useEffect, useLayoutEffect will run its cleanup and initialization
// functions each time a component is suspended.
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
isMountedRef.current = true;

return () => {
Expand Down

0 comments on commit 98cacc9

Please sign in to comment.