Cache computed results is very important. Naturally GraphQL or NextQL resolve values with separate data queries against multi sources. It could return inconsistent results, if backend data changes happened between resolvers executions.
For example:
{
getPages: {
content: 1,
owner: { // owner is computed from pageId
name: 1,
avatar: 1
}
}
}
results
{
getPages: [{
content: "hello1",
owner: {
name: "giapnh",
avatar: "cat"
}
}, {
content: "hello2",
owner: {
name: "giapnh",
avatar: "dog" <- I change my avatar from "cat" to "dog" between nextql query pages.
}
}]
}
To solve the issue you could use Facebook's dataloader. But I think nextql should able solve the issue, so other nextql-plugins don't need to code their cache solutions.
Cache computed results is very important. Naturally GraphQL or NextQL resolve values with separate data queries against multi sources. It could return inconsistent results, if backend data changes happened between resolvers executions.
For example:
results
To solve the issue you could use Facebook's dataloader. But I think nextql should able solve the issue, so other nextql-plugins don't need to code their cache solutions.