-
Hi, I am have a query that retrieves an object of recipe ingredients. I am trying to compare this against an existing object, and I have been trying to do it through JSON.stringify to avoid a too expensive operation of checking each individual nested object. I am running into the problem that the Query response object is changing order of the nested objects, and I can't figure out why. See here, this is the same object just 2 render a part (I am using React Native):
As you can see, they contain the same information but the first starts with the "id" nested object while the second has reordered and now starts with __typename. Is this expected behaviour or is there something I can do to ensure that the return queries always return the same structure of the object? Is there something async going on behind the scenes in URQL that orders the query response after it has been received? Apologies for the many questions, this has been a bit of a headscratcher for me |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hm, I believe you're using What happens when you receive a response from the server is that it's "enhanced" by Graphcache in that it may be mutated with I believe we could totally ship an enhancement for this, since I'd say this is a little confusing; That being said, I would say if you're comparing the results using |
Beta Was this translation helpful? Give feedback.
Hm, I believe you're using
@urql/exchange-graphcache
, since I just realised it will always add__typename
first, regardless of when it has been requested. cc @JoviDeCroock we may just want to ditch it from automatically being added to objects. Otherwise the ordering looks really consistent to me.What happens when you receive a response from the server is that it's "enhanced" by Graphcache in that it may be mutated with
resolvers
when it comes back from the API. Subsequently responses are virtually generated just from cache, so you may see this small transition on an initial mount sometimes, depending on React's timing.I believe we could totally ship an enhancement for this, since I'd sa…