Skip to content

Conversation

@jerelmiller
Copy link
Member

pollInterval and returnPartialData were options supported by the QueryOptions type used by client.query even though these options threw at runtime. These have been removed in the QueryOptions type in this PR.

notifyOnNetworkStatusChange was also an option that was supported, though its effects were not observable by client.query. I've removed support for this and runtime will now throw if this is set.

I've also removed support for the standby fetch policy for client.query. This fetch policy made no sense since it doesn't fetch and just returns { data: undefined }. An error will be thrown at runtime if this is set.

@jerelmiller jerelmiller requested a review from phryneas April 16, 2025 05:29
@changeset-bot
Copy link

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: 4cc52d8

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 Major

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 Apr 16, 2025

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch release-4.0 is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch version-2.6
  • !docs set-base-branch main

Build ID: 1b43a16c0fc980861b504da7

@pkg-pr-new
Copy link

pkg-pr-new bot commented Apr 16, 2025

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

commit: dc62585

@github-actions
Copy link
Contributor

github-actions bot commented Apr 16, 2025

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 42.25 KB (+0.09% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.85 KB (+0.22% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.44 KB (+0.33% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 27.37 KB (-0.08% 🔽)
import { ApolloProvider } from "@apollo/client/react" 5.19 KB (+1.01% 🔺)
import { ApolloProvider } from "@apollo/client/react" (production) 962 B (0%)
import { useQuery } from "@apollo/client/react" 10.92 KB (+0.38% 🔺)
import { useQuery } from "@apollo/client/react" (production) 6.67 KB (0%)
import { useLazyQuery } from "@apollo/client/react" 6.36 KB (+0.51% 🔺)
import { useLazyQuery } from "@apollo/client/react" (production) 2.13 KB (0%)
import { useMutation } from "@apollo/client/react" 5.77 KB (+0.95% 🔺)
import { useMutation } from "@apollo/client/react" (production) 1.53 KB (0%)
import { useSubscription } from "@apollo/client/react" 6.07 KB (+0.86% 🔺)
import { useSubscription } from "@apollo/client/react" (production) 1.83 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" 7.8 KB (+0.45% 🔺)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.58 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" 7.62 KB (+0.4% 🔺)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.42 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" 7.61 KB (+0.31% 🔺)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.41 KB (0%)
import { useReadQuery } from "@apollo/client/react" 5.85 KB (+0.93% 🔺)
import { useReadQuery } from "@apollo/client/react" (production) 1.62 KB (0%)
import { useFragment } from "@apollo/client/react" 5.92 KB (+0.9% 🔺)
import { useFragment } from "@apollo/client/react" (production) 1.68 KB (0%)

@jerelmiller jerelmiller force-pushed the jerel/deprecate-some-query-opts branch from c9c81a7 to 5b1e718 Compare April 16, 2025 05:31
@netlify
Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for apollo-client-docs ready!

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

@netlify
Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 4cc52d8
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/68013135d5dd2e000845a085
😎 Deploy Preview https://deploy-preview-12562--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.

});

describe("when notifyOnNetworkStatusChange is set", () => {
it("does not save the data to the cache on success", async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are identical to some tests above with the exception that notifyOnNetworkStatusChange was passed to client.query. With this option removed, these tests no longer made sense to keep around.

Copy link
Member

@phryneas phryneas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less undefined behaviour - always happy about that :)

"to receive multiple results from the cache and the network, or consider " +
"using a different fetchPolicy, such as cache-first or network-only."
);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to consider wrapping all these invariants in __DEV__?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I like that idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerelmiller jerelmiller force-pushed the jerel/deprecate-some-query-opts branch from cbc105c to dc62585 Compare April 17, 2025 16:47
@jerelmiller jerelmiller merged commit 90bf0e6 into release-4.0 Apr 17, 2025
37 checks passed
@jerelmiller jerelmiller deleted the jerel/deprecate-some-query-opts branch April 17, 2025 16:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants