Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

refetch from query returns data from cache instead of new data #3457

Closed
@anmolchandra96

Description

@anmolchandra96

The refetch function when executed returns a promise which resolves with the data from the cache instead of data from the re-run query.

Example:

<Query query={SAMPLE_QUERY} fetchPolicy="cache-and-network"> { ({ refetch }) => <ChildComponent refetchParent={refetch} /> } </Query>

In the case above whenever I execute the refetchParent function I get a promise which resolves with the value from the data in the cache instead of the data from the re-run query.

My requirements force me to set the base query fetch policy as cache-and-network but I want to make sure when refetch function is executed I get data from the re-run query instead of data from the cache.

Any help on the issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions