Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useReadQuery/useQueryRefHandlers: Fix a "hook order" warning that might be emitted in React 19 dev mode. #12341

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented Feb 5, 2025

Up until now the communication from the React team was that it was technically okay to call useContext conditionally, but apparently React 19 now warns in dev mode on hook order changes - also for useContext.

This should fix that.

image

@phryneas phryneas requested a review from jerelmiller February 5, 2025 12:53
Copy link

changeset-bot bot commented Feb 5, 2025

🦋 Changeset detected

Latest commit: fc03fcb

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

@svc-apollo-docs
Copy link

svc-apollo-docs commented Feb 5, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: eaee2ada85813deb080c67e7

Copy link

pkg-pr-new bot commented Feb 5, 2025

npm i https://pkg.pr.new/@apollo/client@12341

commit: 86e24b3

Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit bda2682
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/67a35f321881de0008e2963d
😎 Deploy Preview https://deploy-preview-12341--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.

Copy link
Contributor

github-actions bot commented Feb 5, 2025

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 40.67 KB (-0.01% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 50.08 KB (+0.01% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 47.2 KB (+0.01% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 36.18 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 33.58 KB (0%)
import { ApolloProvider } from "dist/react/index.js" 1.26 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.24 KB (0%)
import { useQuery } from "dist/react/index.js" 5.21 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.29 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.7 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.78 KB (0%)
import { useMutation } from "dist/react/index.js" 3.62 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.84 KB (0%)
import { useSubscription } from "dist/react/index.js" 4.42 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 3.48 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.51 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.17 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 5.01 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.66 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 5.09 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.74 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.42 KB (+0.18% 🔺)
import { useReadQuery } from "dist/react/index.js" (production) 3.36 KB (+0.24% 🔺)
import { useFragment } from "dist/react/index.js" 2.36 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.31 KB (0%)

Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit fc03fcb
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/67a3a1c6e8ed2300086a7c3f
😎 Deploy Preview https://deploy-preview-12341--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.

@github-actions github-actions bot added the auto-cleanup 🤖 label Feb 5, 2025
@phryneas phryneas merged commit f2bb0b9 into main Feb 5, 2025
39 checks passed
This was referenced Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants