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

Handle additional cases in unmasked types #12154

Merged
merged 24 commits into from
Nov 25, 2024

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented Nov 21, 2024

For context, this had some Discord help:

https://discord.com/channels/997886693233393714/1309495105027313725
(if you're not on the server yet: https://t.co/0PGvmQUEIO)

@svc-apollo-docs
Copy link

svc-apollo-docs commented Nov 21, 2024

✅ Docs Preview Ready

No new or changed pages found.

Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: 7769b76

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

pkg-pr-new bot commented Nov 21, 2024

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

commit: 5fe3bcc

Copy link
Contributor

github-actions bot commented Nov 21, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 40.64 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 50.8 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 47.68 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 36.15 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 33.56 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.3 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.71 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.85 KB (0%)
import { useSubscription } from "dist/react/index.js" 4.43 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%)
import { useReadQuery } from "dist/react/index.js" (production) 3.36 KB (0%)
import { useFragment } from "dist/react/index.js" 2.37 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.31 KB (0%)

@phryneas phryneas marked this pull request as ready for review November 22, 2024 16:54
@phryneas phryneas requested a review from jerelmiller November 22, 2024 17:02
@@ -2971,6 +2971,7 @@ describe("ApolloClient", () => {

test("client.mutate uses masked/unmasked type when using Masked<TData>", async () => {
type UserFieldsFragment = {
__typename: "User";
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 missing caused problems - the question is: would they be missing in a real life case with codegen, or just with our hand-written types?

Copy link
Member

Choose a reason for hiding this comment

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

Unless someone turns off the skipTypename option (possible, but I'd suggest we enforce this as a requirement), this should only be a problem with our hand-written types (or hand-written types in general, which again we can encourage not to do).

Good catch on this though. I'll comb through the new masking tests and make sure __typename is added everywhere. This is just a goof on my part.

@phryneas phryneas changed the title WIP: fragment masking type tuning Handle additional cases in unmasked types Nov 25, 2024
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

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

Code looks good. There are some failing tests, but I'll look into it and fix them before merging. Appreciate you going further on this one!

@github-actions github-actions bot added the auto-cleanup 🤖 label Nov 25, 2024
@jerelmiller jerelmiller merged commit d933def into release-3.12 Nov 25, 2024
33 of 37 checks passed
@jerelmiller jerelmiller deleted the pr/tuning-fragment-masking branch November 25, 2024 22:38
@github-actions github-actions bot mentioned this pull request Nov 25, 2024
This was referenced Dec 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 26, 2024
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.

3 participants