Describe the bug
Hi, i've been exploring adding the @defer directive to our graphql server and believe I've come across an issue with urql.
When deferring on the root Query fragment, urql will respond with an undefined key in the data response.
Versions:
"@graphql-yoga/plugin-defer-stream": "^1.7.1"
"@urql/core": "^4.0.1"
"graphql": "17.0.0-alpha.2"
"urql": "^4.0.0"
Expected behavior
Entire query is resolved and merged together
data: {
song: { firstVerse: "Now I know my ABC's.", secondVerse: "Next time won't you sing with me?" },
},
Actual behavior
Query is split via an undefined key
data: {
song: { firstVerse: "Now I know my ABC's." },
undefined: { song: [Object] }
},
This was verified by using the with-defer-stream-directives example with the following script below
import { Client, gql, debugExchange, fetchExchange } from 'urql';
import fetch from 'node-fetch';
const SONGS_QUERY = gql`
query App_Query {
... on Query @defer {
song {
secondVerse
}
}
song {
firstVerse
}
}
`;
const client = new Client({
url: 'http://localhost:3004/graphql',
fetch: fetch,
exchanges: [debugExchange, fetchExchange],
});
client.query(SONGS_QUERY).then(response => {
console.log('LOG response: ', response);
});
This is resolved if we do not @defer the root Query fragment. E.g.
query App_Query {
song {
firstVerse
... on Song @defer {
secondVerse
}
}
}
However I'm unable to do so ATM due to lack of schema stitching support (ardatan/graphql-tools#1941)
I believe this to be a bug from the side of urql
Reproduction
Apologies, found this difficult to setup
Urql version
urql v4.0.0
Validations
Describe the bug
Hi, i've been exploring adding the
@deferdirective to our graphql server and believe I've come across an issue withurql.When deferring on the root
Queryfragment,urqlwill respond with anundefinedkey in the data response.Versions:
"@graphql-yoga/plugin-defer-stream": "^1.7.1""@urql/core": "^4.0.1""graphql": "17.0.0-alpha.2""urql": "^4.0.0"Expected behavior
Entire query is resolved and merged together
Actual behavior
Query is split via an
undefinedkeyThis was verified by using the
with-defer-stream-directivesexample with the following script belowThis is resolved if we do not
@deferthe rootQueryfragment. E.g.However I'm unable to do so ATM due to lack of schema stitching support (ardatan/graphql-tools#1941)
I believe this to be a bug from the side of
urqlReproduction
Apologies, found this difficult to setup
Urql version
urql v4.0.0
Validations