Skip to content

Cache computed results #6

Description

@giapnguyen74

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions