-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
skip unmasking for types without fragments #12152
Conversation
✅ Docs Preview ReadyNo new or changed pages found. |
🦋 Changeset detectedLatest commit: 906919d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
size-limit report 📦
|
src/masking/types.ts
Outdated
T extends { " $fragmentRefs"?: any } ? | ||
UnwrapFragmentRefs<T> | ||
: { [K in keyof T]: FastForwardUnmask<T[K]> } | ||
: T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need to handle arrays in here, otherwise if the type is buried in an array, I think it might miss it. Does this work with this type?
type Query = {
posts: Array<{
__typename: "Post",
id: string;
} & { " $fragmentRefs"?: {...}>
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object mapping works recursively over arrays, too, if it's a "simple object mapping", meaning without renaming keys etc.
So in most cases we should not need any extra handling.
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I'm still looking into ways to make this potentially faster, but this should already enable a "safer" option for types that didn't contain fragments in the first place.