Strip __fragments field for non-query operations from fat/broad query#623
Conversation
|
Thanks! Can you see what test coverage we have for this, presumably only for a query, and run the same test for subscription/mutation docs? |
The tests for The tests for Added tests in both files. @alloy |
|
@microsoft-github-policy-service agree |
… in subscription/mutation operations.
Strip __fragments field for non-query operations from fat/broad query
Subscriptions with fragment spreads were failing with errors about __fragments field not being found in the schema.
Root cause:
annotateFragmentReferenceTransform adds "... on Node { __fragments @client }" to all operations with fragment spreads. For queries, stripFragmentReferenceFieldSelectionTransform removes this from executionQueryDocument before output. For subscriptions/mutations, this stripping was being skipped.
Fix:
Move the stripping logic outside the "if (emitNarrowObservables)" block so it runs for all operation types, not just queries.