Skip to content

fix(visitor-plugin-common): keep deferred fields optional with overlapping named @defer spreads#10898

Open
redox wants to merge 3 commits into
dotansimha:masterfrom
altertable-ai:fix/defer-named-spread-overlapping-fields
Open

fix(visitor-plugin-common): keep deferred fields optional with overlapping named @defer spreads#10898
redox wants to merge 3 commits into
dotansimha:masterfrom
altertable-ai:fix/defer-named-spread-overlapping-fields

Conversation

@redox

@redox redox commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Named @defer/@stream fragment spreads were typed as a single union of all fragment fields. When a field like id was also selected outside the spread, intersecting with the required outer field eliminated the absent branch and made deferred-only fields required.
  • Expand incremental named spreads into per-selection nodes (same shape as inline @defer) so each deferred field stays its own optional union. Fragment masking (inlineFragmentTypes: "mask") is unchanged and still uses Incremental<> fragment refs.

Test plan

  • Added regression test for overlapping id + named @defer (fails before fix, passes after)
  • Updated related @defer / @skip+@defer snapshots for per-field unions
  • vitest incremental delivery + skip/include defer suites green
  • Client-preset @defer tests green

Made with Cursor

…pping named @defer spreads

Expand @defer/@stream named fragment spreads into per-selection nodes so intersecting an outer field like `id` no longer collapses deferred-only fields to required.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e195bc9

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

This PR includes changesets to release 2 packages
Name Type
@graphql-codegen/visitor-plugin-common Patch
@graphql-codegen/typescript-operations 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

redox and others added 2 commits July 16, 2026 10:39
…sted spreads

Preserve fragmentDirectives for interface/union @defer, promote nested
@defer through inlined spreads, and restore trailing _ on implementing-type
aliases when omitOperationSuffix is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@redox

redox commented Jul 16, 2026

Copy link
Copy Markdown
Author

@eddeee888 most of this work was driven by a wrongly typed fragment on our private repository; I'm not sure I get why so many changes were required but I appreciated reviewing the tests the AI wrote. Let me know if you have any opinion on this.

@eddeee888 eddeee888 self-assigned this Jul 16, 2026
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.

2 participants