[near-operation-file-preset] Fix missing fragment document imports for nested fragments (graphQLTag)#1530
Open
wassim-k wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: 5a8e411 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 |
wassim-k
force-pushed
the
fix/near-operation-file-fragment-import
branch
from
June 29, 2026 00:39
c075f95 to
e8bcf2f
Compare
…r nested fragments (graphQLTag) Since visitor-plugin-common v7, graphQLTag operations inline every transitively-spread fragment, so import a fragment's *Doc wherever it's interpolated, not just at direct-spread level.
wassim-k
force-pushed
the
fix/near-operation-file-fragment-import
branch
from
June 29, 2026 00:39
e8bcf2f to
5a8e411
Compare
1 task
Contributor
Author
|
Hi @eddeee888, the tests for this fix will only pass once the client plugins ( What are your thoughts on the best way to tackle this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since
visitor-plugin-commonv7, indocumentMode: graphQLTag(default) an operation document inlines every fragment it transitively spreads, while a fragment document inlines nothing. The preset still imports*Docs by direct-spread (level === 0), so:*Docof fragments reached through another fragment →Cannot find name 'XFragmentDoc';*Docs they no longer interpolate → unused imports.Reproduction
query List { list { ...Book } },fragment Book on Book { pages { ...Page } },fragment Page on Page { id }— each in its own file.Type of change
How Has This Been Tested?
Added new unit tests and ran the fixed version against our codebase with 100s of GraphQL queries
Notes
I have taken some liberty in trimming some code paths that are no longer used, which coincidentally happens to be my code from across the years