Description
I am creating 1 record and add to the cache so that data gets quickly in the UI. It works as expected. I have a scenario in which I need to add many records (meaning the user can create a set of records) to cache so that it will reflect in UI quickly. Record counts maybe 2-4. When I am trying to add 2nd record, it fails with error - Error: Can't find field __typename on object { "id": "7571ef50-f621-4c68-88d8-d86fb0dc5938",
here 7571ef50-f621-4c68-88d8-d86fb0dc5938
is id
of 1st object created.
The error happens while reading cache with store.readQuery
Actual outcome:
I am able to add 1 record. when I second record, it fails with error Error: Can't find field __typename on object
Expected outcome:
I am able to add 1 record. when I second record, it should not fail as I am trying to add a similar object as the first one. All objects do not have __typename
as it is created by the framework. I can not add __typename
as it fails with schema validation saying that Error: GraphQL error: The variables input contains a field name '__typename' that is not defined for input object type 'CreateSessionInput'
Please help me with any possible solution.