Skip to content

mutations through watchQuery use cacheAndNetwork, which yields unexpected results #774

@micimize

Description

@micimize

the default fetch policy for client.mutate is networkOnly, because it is usually the case that the fields requested correspond to mutated data, and thus are expected to be stale if fetched eagerly from the cache.

However, when a mutation is made with client.watchQuery (such as with the Mutation widget), the cacheAndNetwork policy is used by default, resulting in unexpectedly stale data when an optimisticResult is not provided.

Another serious issue is that the same mutation, with the same variables, might return different entities. If those results are used in parts of the application, the results of the latest usage will overwrite those of the older ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    📦 cacheRelates to caching functionalityPRs encouragedPRs are welcome if stakeholders want to take ownershipflutterIssue relates mainly to graphql_flutterreleasedreleased on @beta

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions