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

feat: Support disableMasking: true option to disable fragment masking globally #69

Merged
merged 5 commits into from
Feb 22, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Feb 22, 2024

This is a feature preview, and while we consider it stable and ready for production, we may consider changing it before the next minor release!

Summary

This feature is enabled by configuring gql.tada with the disableMasking: true flag.

export const graphql = initGraphQLTada<{
  introspection: introspection;
  disableMasking: true;
}>();

When enabled, fragment masking is completely disabled, similar to if you added @_unmask to every single fragment.

We consider this a necessary addition for some projects that would otherwise run into trouble when having a “document cache” where query data is modified as a whole, which is a bad match for fragment masking.

Set of changes

  • Add disableMasking: flag forcing masked: false on fragment references

Copy link

changeset-bot bot commented Feb 22, 2024

🦋 Changeset detected

Latest commit: dedd07d

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

Comment on lines +132 to +139
expectTypeOf<ResultOf<typeof query>>().toEqualTypeOf<{
todos:
| ({
id: string | number;
text: string;
} | null)[]
| null;
}>();

Choose a reason for hiding this comment

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

This looks to be the exact output needed to make this work with normalized store cache updates.

@kitten kitten merged commit 1dc8cf5 into main Feb 22, 2024
4 checks passed
@kitten kitten deleted the feat/disabling-masks branch February 22, 2024 19:56
@github-actions github-actions bot mentioned this pull request Feb 22, 2024
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.

None yet

3 participants