Skip to content

CODEGEN-859 [graphql-modules-preset] Fix __isTypeOf getting picked from from all objects - #10447

Merged
eddeee888 merged 4 commits into
masterfrom
fix-modules
Sep 24, 2025
Merged

eddeee888 merged 4 commits into
masterfrom
fix-modules

Conversation

@eddeee888

Copy link
Copy Markdown
Collaborator

Description

This PR fixes __isTypeOf getting picked from all objects.
With https://github.com/dotansimha/graphql-code-generator/releases/tag/release-1757264511789 release, __isTypeOf is only generated for implementing types and union members.

This PR applies the same logic to graphql-modules-preset to make sure it's correctly picked.

Related #10438

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit test

@changeset-bot

changeset-bot Bot commented Sep 23, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d3256d9

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

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/graphql-modules-preset 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

defined.unions.push(name);

for (const namedType of node.types || []) {
pushUnique(withIsTypeOf.objects, namedType.name.value);

@eddeee888 eddeee888 Sep 23, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm using pushUnique for union type here (unlike .push on other type definition) because a union may contain a union member that already exists on another union declaration.

@github-actions

github-actions Bot commented Sep 23, 2025 •

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/graphql-modules-preset 5.0.1-alpha-20250923134201-d3256d9fcce8c6b3042fddbb280ab439609d2992 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Sep 23, 2025 •

Copy link
Copy Markdown
Contributor

💻 Website Preview

The latest changes are available as preview in: https://pr-10447.graphql-code-generator.pages.dev

@eddeee888
eddeee888 merged commit 5dad86e into master Sep 24, 2025
18 checks passed
@eddeee888
eddeee888 deleted the fix-modules branch September 24, 2025 11:16

This branch was successfully deployed

1 active deployment
preview — d3256d9f Deployed Sep 23, 2025 by github-actions[bot]
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.

1 participant