Skip to content

Conversation

eddeee888
Copy link
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

Copy link

changeset-bot bot commented Sep 23, 2025

🦋 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);
Copy link
Collaborator Author

@eddeee888 eddeee888 Sep 23, 2025

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.

Copy link
Contributor

github-actions bot commented Sep 23, 2025

🚀 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 ↗︎

Copy link
Contributor

github-actions bot commented Sep 23, 2025

💻 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
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