I test relay, and I use relay-local-schema for test graph-ql request in client memory.
All are good, and when the sendQueries method is called I fetch the good data. I can check this in debug.
But after, I have this error message :
RelayQueryWriter: Unexpectedly encountered undefined
in payload. Cannot set root record client:4122484501
to undefined.
I don't understand the error message and it is very difficult for me to understand the problem.
I use typescript and tsx extentention.
thanks in advance, if you have any Idea for my problem
EDIT : RESOLVED
I make a mistake with the promise in the sendQuery method
with this all is better:
sendQueries(queryRequests) {
return Promise.all(
queryRequests.map(queryRequest =>
graphql.graphql(
this._schema,
queryRequest.getQueryString(),
this._rootValue,
queryRequest.getVariables()
).then(result => {
if (result.errors) {
queryRequest.reject(new Error("..."));
} else {
queryRequest.resolve({response: result.data});
}
})
)
);
}
I make a mistake with the promise in the sendQuery method.
I make a mistake with the promise in the sendQuery method
with this all is better:
sendQueries(queryRequests) {
return Promise.all(
queryRequests.map(queryRequest =>
graphql.graphql(
this._schema,
queryRequest.getQueryString(),
this._rootValue,
queryRequest.getVariables()
).then(result => {
if (result.errors) {
queryRequest.reject(new Error("..."));
} else {
queryRequest.resolve({response: result.data});
}
})
)
);
}
But I don't understand why I haved this error message : Relay - RelayQueryWriter: Unexpectedly encountered undefined
in payload