Skip to content

v4: Using fetchMore and then refetch causes duplicated results. #1026

Open
@MechJosh0

Description

@MechJosh0

Describe the bug
Using fetchMore and then refetch causes duplicated results.

To Reproduce
Steps to reproduce the behavior:

  1. Load results from backend using useQuery
  2. Use fetchMore to load the next page
  3. Perform a search on the results using refetch
    • You must only trigger refetch once, so if you're using a search input you should paste the search query in. Typing a query manually and performing more than 1 refetch will not reproduce the bug
    • You must produce this bug on the first refetch you perform, any following refetch calls will not reproduce the bug
    • The bug will only be reproducible on the first time you do it, to reproduce it again you have to reload
    • The found item does not have to be in memory, reproducible either way

What happens
The results found are duplicated from useQuery.

Expected behaviour
The results should only be what was discovered from the Graph call to the backend that came from your refetch call.

Versions
vue: 2.6.11
vue-apollo: v4.0.0-alpha.10
apollo-client: 2.6.10

Additional context
During the steps to reproduce, if you watch the Ref result from useQuery you will notice how result changes twice. The first instance will be the correct value and the second time it's the incorrect value due to duplicated items.

You will also notice that when you perform your refetch it will only do one Graph backend call, which is expected. The results returned from the server are the correct results. Only one Graph call is perform but watching result from useQuery is still triggered twice with the correct and then incorrect value).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions