Skip to content

Conversation

@jerelmiller
Copy link
Member

Closes #11524

Add support for skipToken with useQuery.

@jerelmiller jerelmiller requested a review from phryneas August 29, 2025 23:58
@jerelmiller jerelmiller requested a review from a team as a code owner August 29, 2025 23:58
@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2025

🦋 Changeset detected

Latest commit: 89ca02a

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

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

@apollo-librarian
Copy link

apollo-librarian bot commented Aug 29, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 2 changed, 0 removed
* (developer-tools)/react/(latest)/api/react/skipToken.mdx
* (developer-tools)/react/(latest)/data/queries.mdx

Build ID: ccca34baa4b138bd8f97e246
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/ccca34baa4b138bd8f97e246

@@ -0,0 +1,13 @@
---
"@apollo/client": patch
Copy link
Member Author

Choose a reason for hiding this comment

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

We still want this as a patch correct?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we add a little bit more prose to explain why we do it as a patch (variables are hard to use with the new types otherwise) to the changeset, but yeah, I think this can count as a fixup of an oversight.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 30, 2025

npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@12895

commit: 89ca02a

</tbody>
</table>
<MinVersion version="4.0.4">
Copy link
Member Author

Choose a reason for hiding this comment

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

May need updating if we don't get this in 4.0.4

@github-actions
Copy link
Contributor

github-actions bot commented Aug 30, 2025

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 42.82 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.8 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.66 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 26.85 KB (0%)
import { ApolloProvider } from "@apollo/client/react" 5.91 KB (0%)
import { ApolloProvider } from "@apollo/client/react" (production) 994 B (0%)
import { useQuery } from "@apollo/client/react" 7.35 KB (+1.89% 🔺)
import { useQuery } from "@apollo/client/react" (production) 2.39 KB (+6.08% 🔺)
import { useLazyQuery } from "@apollo/client/react" 7.11 KB (0%)
import { useLazyQuery } from "@apollo/client/react" (production) 2.16 KB (0%)
import { useMutation } from "@apollo/client/react" 6.47 KB (0%)
import { useMutation } from "@apollo/client/react" (production) 1.52 KB (0%)
import { useSubscription } from "@apollo/client/react" 6.79 KB (0%)
import { useSubscription } from "@apollo/client/react" (production) 1.81 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" 8.55 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.63 KB (-0.03% 🔽)
import { useBackgroundQuery } from "@apollo/client/react" 8.33 KB (+0.02% 🔺)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.4 KB (+0.03% 🔺)
import { useLoadableQuery } from "@apollo/client/react" 8.3 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.39 KB (0%)
import { useReadQuery } from "@apollo/client/react" 6.6 KB (0%)
import { useReadQuery } from "@apollo/client/react" (production) 1.65 KB (0%)
import { useFragment } from "@apollo/client/react" 6.66 KB (0%)
import { useFragment } from "@apollo/client/react" (production) 1.71 KB (0%)

await expect(takeSnapshot).not.toRerender();
});

it("should refetch when providing skipToken", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

This one is so weird since technically the variables are gone now.

How should we handle this if you go from passing in variables to skipToken - should refetch refetch with the previous variables, or with no variables?

This might need a bit of thought.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed in person. Since useSuspenseQuery and useBackgroundQuery allow refetch with skipToken, we are going to leave this the same. This could mean you see runtime errors if refetching with required variables.

jerelmiller and others added 3 commits September 2, 2025 09:09
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
@github-actions github-actions bot added the auto-cleanup 🤖 label Sep 2, 2025
@jerelmiller
Copy link
Member Author

Before merge, update the changelog description

@jerelmiller jerelmiller force-pushed the jerel/support-skip-token branch from 901140e to 8f8004d Compare September 2, 2025 15:56
@jerelmiller jerelmiller merged commit 71f2517 into main Sep 2, 2025
44 checks passed
@jerelmiller jerelmiller deleted the jerel/support-skip-token branch September 2, 2025 16:07
@github-actions github-actions bot mentioned this pull request Sep 2, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 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.

Introduce skipToken to useQuery

3 participants