Switching to a Union Type causes cache.updateQuery to return data as null #3418
Unanswered
Undistraction
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I added a schema and the problem is resolved. It would be good to understand exactly why that fixed the problem. Given that each item in the list includes a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are using the graphcache exchange and this has been working really well for us for a while. However we've just made a change to the API which has meant moving from a list containing a single type, to a a list containing a Union type:
To a union:
We have a query that gets all the
ChatMessages
for anEnrolment
which is run once the app has initialised (TheEnrolmentForChatMessagesQuery
referenced below).When we create a new
ChatMessage
withcreateChatMessage
, the new message is returned and we append it to the current list of chat messages in an update function. This was working great before switching to a union type and whereas beforedata
was the expected value, it is now alwaysnull
.Would really appreciate some help in tracking down the issue as I'm unsure how to debug it. It doesn't seem like a type-change should have this effect, but this is the only change. If I replace the revert this change,
data
comes back as expected.Would providing a schema to graphcache help? Our API is behind auth and we couldn't expose our API schema by including a schema in the src so we'd have to introspect at runtime which is not idea.
Beta Was this translation helpful? Give feedback.
All reactions