Open tomgasson opened 2 years ago
Oh, interesting. I wonder how we didn't got this internally.
I'm not sure what is the right fix could be here... Can you try adding a __typename
field explicitly to your queries?
Yeah there's a few workarounds here, that all work:
__typename
in the mock__typename
Mostly just reporting for visibility in case someone else hits this too. A simple fix to MockPayloadGenerator might just sort the selections to shift a __typename
up to the top before generating?
We have a regression between v12 and v13 in example queries using
MockPayloadGenerator
.This is caused by a bug in MockPayloadGenerator, but appears as a regression when upgrading.
It has to do with the feature where the
__typename
is correctly provided in the mock payload if you don't provide a__typename
value in the mock data.Assume we have these 2 selections generated by the compiler(s):
For a query that looks like this
These 2 selections are going to be in a request under a linked field
The JS compiler always output the
__typename
field first in this list of selectionsWhich leads to this (correct) output
The rust compiler changed the output ordering of fields, and
__typename
is no longer first.Now this gives us incorrect output
This means that queries that we're previously mocked fine no longer work