[5.x] Make sure combining queries don't read the same stream multiple times#1268
Merged
Conversation
indykoning
approved these changes
Apr 28, 2026
Member
indykoning
left a comment
There was a problem hiding this comment.
...about how the fetch function sends a responseClone instead of just the actual response data (I'm sure there's a reason, but I didn't dig for it)
That's so the GraphqlError can extend FetchError, so if you catch a FetchError GraphqlErrors can be caught as well
| throw error | ||
| } | ||
|
|
||
| const errorResponse = await error.response.json() |
Member
There was a problem hiding this comment.
Are there any other places this change should be used?
Collaborator
Author
There was a problem hiding this comment.
The only other possible place would be AddToCart.vue. However, this doesn't use combiningGraphQL so it's not relevant at this point.
I do notice that Graphql.vue uses combiningGraphQL, but it doesn't actually call .json() on the response when there's an error which is interesting 👀
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.
ref: GT-2543
In our Sentry logging we noticed that sometimes, graphql queries would have their error body already seemingly read. This was puzzling at first, because there's no obvious way to have this happen.
However, in the
submitPartialscode, it turns out that whencombiningGraphQLgets used, it will send the same error object to all of the graphql components that got combined. While I wasn't able to verify this was actually happening, the code seemed pretty clear cut and dry to me in this instance.Because I didn't want to change anything about how the fetch function sends a responseClone instead of just the actual response data (I'm sure there's a reason, but I didn't dig for it), I instead reworked this part to work to work with concurrency by using a shared responseData object in the error object. Note that the naive way to do this would run into race conditions, so instead I store the awaitable part once, and then await it after.