Closed playerx closed 5 years ago
There was a silly mistake in my example, resolver should look like this:
resolvers: {
Query: {
testData: () => 'Hello X',
},
State: {
draft: ({id}) => {
console.log('draft resolver')
return {
__typename: 'State',
id,
draft: "client-side data",
}
},
},
Problem
We need to extend GraphQL types on client side and resolve them, here is an example:
for this client schema if we will run query:
testData
will be resolved, butState.draft
will not. It will be useful to have such ability to extend any graphql type on client sideWorkaround
I don't know workaround yet
Solution
I don't know source code in details, but solution (in theory) is to make recursive call, check all
@client
directives on the tree and call their resolvers, instead of making call only on root level