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

Call nextFetchPolicy with "variables-changed" even if there is a fetchPolicy option specified. #11626

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

phryneas
Copy link
Member

fixes #11365

@phryneas phryneas requested a review from a team as a code owner February 27, 2024 11:46
Copy link

changeset-bot bot commented Feb 27, 2024

🦋 Changeset detected

Latest commit: 39737d8

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

Copy link
Contributor

github-actions bot commented Feb 27, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.17 KB (+0.04% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 45.97 KB (+0.01% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 43.52 KB (+0.02% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 33.91 KB (+0.03% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 31.83 KB (+0.03% 🔺)
import { ApolloProvider } from "dist/react/index.js" 1.23 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.22 KB (0%)
import { useQuery } from "dist/react/index.js" 5.2 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.27 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.5 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.58 KB (0%)
import { useMutation } from "dist/react/index.js" 3.51 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.73 KB (0%)
import { useSubscription } from "dist/react/index.js" 3.19 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 2.38 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.28 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 3.94 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.75 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.4 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 4.97 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.63 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.04 KB (0%)
import { useReadQuery } from "dist/react/index.js" (production) 2.98 KB (0%)
import { useFragment } from "dist/react/index.js" 2.18 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.13 KB (0%)

Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 39737d8
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65ddd74c88e4870008fad194
😎 Deploy Preview https://deploy-preview-11626--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.

(options.fetchPolicy === oldFetchPolicy ||
// A `nextFetchPolicy` function has even higher priority, though,
// so in that case `applyNextFetchPolicy` must be called.
typeof options.nextFetchPolicy === "function")
) {
this.applyNextFetchPolicy("variables-changed", options);
if (newNetworkStatus === void 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems that lines 917-920
(

if (newNetworkStatus === void 0) {
    newNetworkStatus = NetworkStatus.setVariables;
        }

could be removed completely without failing any test. In fact, the new network status is set as part of QueryInfo.init.

I did not remove it, though, to prevent any unforseen consequences - but wanted to have noted it somewhere.

@phryneas
Copy link
Member Author

/release:pr

Copy link
Contributor

A new release has been made for this PR. You can install it with npm i @apollo/client@0.0.0-pr-11626-20240227132301.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nextFetchPolicy function is not called sometimes
1 participant