You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user choose data (it contains schema-less JSON data) from the list.
user will modify the data and submit it to server.
I implement step 1 by GraphQL query (fetch list from server) and mutation (update local state by @client mutation).
I used cache.writeData to hold data that is selected by user.
but cache.writeData can't handling scalar JSON data.
Uncaught (in promise) Invariant Violation: Missing selection set for object of type undefined returned for query field data
at new InvariantError (https://o4r2lk7nmz.codesandbox.io/node_modules/ts-invariant/lib/invariant.js:16:28)
at assertSelectionSetForIdValue (https://o4r2lk7nmz.codesandbox.io/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js:463:90)
at StoreReader.executeField (https://o4r2lk7nmz.codesandbox.io/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js:401:13)
at eval (https://o4r2lk7nmz.codesandbox.io/node_modules/apollo-cache-inmemory/lib/bundle.cjs.js:350:55)
I found some suspicious parts.
queryFromPojo doesn't respect for custom scalar type.
I tried use cache.writeData with id, but this code can't get result. because I want to write data to it, but this code runs before write.
and this code overwrite my __typename by __ClientData always. cache.writeData ignore my request silently.
Intended outcome:
My GraphQL schema has
scalar JSON
.and, It contains object and array.
My application has a below steps.
I made reproduction code. https://codesandbox.io/s/o4r2lk7nmz
I'm reading https://www.apollographql.com/docs/graphql-tools/scalars.html .
It explains server side implementations, but client side is not.
Actual outcome:
I implement step 1 by GraphQL query (fetch list from server) and mutation (update local state by
@client
mutation).I used
cache.writeData
to hold data that is selected by user.but
cache.writeData
can't handlingscalar JSON
data.I found some suspicious parts.
queryFromPojo doesn't respect for custom scalar type.
I tried use
cache.writeData
withid
, but this code can't get result. because I want to write data to it, but this code runs before write.and this code overwrite my
__typename
by__ClientData
always.cache.writeData
ignore my request silently.How to reproduce the issue:
https://codesandbox.io/s/o4r2lk7nmz
↑ PRESS
EXECUTE MUTATION
buttonVersions
The text was updated successfully, but these errors were encountered: