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.

useQuery returns incorrect results when returning from the cache #3717

Open
@tomitrescak

Description

@tomitrescak

I have a list control that uses useQuery to search for items.
For simplicity I write useQuery(QUERY, XXX), where XXX is a current parameter of the query.

Component calls useQuery in following order (as I type in the search bar):

useQuery(QUERY, '') // all good all records are returned
useQuery(QUERY, 'f') // records only with 'f' in the name are returned
useQuery(QUERY, '') //  ERROR: here I expect again ALL records, but only the 'f' record is shown 

How to reproduce the issue:

Reproduction code in the next post.

Here is a gif:

Nov-27-2019 22-37-02

Version

  System:
    OS: macOS 10.15.1
  Binaries:
    Node: 12.8.0 - /usr/local/bin/node
    Yarn: 1.19.1 - ~/.yarn/bin/yarn
    npm: 6.12.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 78.0.3904.108
    Firefox: 70.0.1
    Safari: 13.0.3
  npmPackages:
    @apollo/client: ^3.0.0-beta.14 => 3.0.0-beta.14 
    @apollo/react-testing: 3 => 3.1.3 
  npmGlobalPackages:
    apollo-fetch: 0.7.0
    apollo: 2.21.0

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