apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.34k stars 2.66k forks source link

update `canUseLayoutEffect` check to also allow for layout effects in React Native #11901

Closed phryneas closed 3 months ago

phryneas commented 3 months ago

For comparison: https://github.com/reduxjs/react-redux/blob/e05ed6840075c9cb75564cb072aa1932f46ce11f/src/utils/useIsomorphicLayoutEffect.ts

Seems like we didn't include a check for React Native in the past, so useIsomorphicLayoutEffect would always behave like useEffect in RN. Also, our version of the uSES shim would write synchronously to the ref during rendering in RN, which is also problemativ.

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 09e90fdf60ed761cd68ec3a24bbfdbcdc941750f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------- | ----- | | @apollo/client | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 3 months ago

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.65 KB (+0.01% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 47.43 KB (+0.02% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 45 KB (+0.01% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 34.2 KB (+0.02% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 32.06 KB (+0.03% 🔺)
import { ApolloProvider } from "dist/react/index.js" 1.24 KB (+0.56% 🔺)
import { ApolloProvider } from "dist/react/index.js" (production) 1.22 KB (+0.49% 🔺)
import { useQuery } from "dist/react/index.js" 5.3 KB (+0.19% 🔺)
import { useQuery } from "dist/react/index.js" (production) 4.37 KB (+0.16% 🔺)
import { useLazyQuery } from "dist/react/index.js" 5.58 KB (+0.15% 🔺)
import { useLazyQuery } from "dist/react/index.js" (production) 4.65 KB (+0.24% 🔺)
import { useMutation } from "dist/react/index.js" 3.57 KB (+0.17% 🔺)
import { useMutation } from "dist/react/index.js" (production) 2.79 KB (+0.22% 🔺)
import { useSubscription } from "dist/react/index.js" 3.21 KB (+0.16% 🔺)
import { useSubscription } from "dist/react/index.js" (production) 2.41 KB (+0.21% 🔺)
import { useSuspenseQuery } from "dist/react/index.js" 5.45 KB (+0.17% 🔺)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.11 KB (+0.1% 🔺)
import { useBackgroundQuery } from "dist/react/index.js" 4.96 KB (+0.22% 🔺)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.61 KB (+0.17% 🔺)
import { useLoadableQuery } from "dist/react/index.js" 5.03 KB (+0.1% 🔺)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.67 KB (+0.19% 🔺)
import { useReadQuery } from "dist/react/index.js" 3.34 KB (+0.3% 🔺)
import { useReadQuery } from "dist/react/index.js" (production) 3.28 KB (+0.33% 🔺)
import { useFragment } from "dist/react/index.js" 2.3 KB (+0.52% 🔺)
import { useFragment } from "dist/react/index.js" (production) 2.24 KB (+0.53% 🔺)
netlify[bot] commented 3 months ago

Deploy Preview for apollo-client-docs ready!

Name Link
Latest commit 91c9f7d7a089cc23c9d30216ef0295f09e572ea3
Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/66799a016caed90008cc6739
Deploy Preview https://deploy-preview-11901--apollo-client-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.