Skip to content

Setting the debounce option makes the query fetch twice + ignores certain fetch policies #982

Open
@cerinoligutom

Description

@cerinoligutom

Describe the bug
Setting the debounce option makes the query fetch twice (2 network calls). Once for the initial fetch, then another after the debounce duration. Only happens with a fetchPolicy of cache-and-network or network-only. The debounce seems to be ignored when it's set to other fetch policies.

To Reproduce
Steps to reproduce the behavior:

  1. Use useQuery
  2. Set debounce option
  3. Observe network in dev tools

Expected behavior

  1. Should not trigger a 2nd fetch after the debounce duration on initial fetch.
  2. Should work on other fetch policies besides cache-and-network and network-only.
  3. Should react on variable changes regardless of fetch policies.

Versions
vue: 2.6.11
vue-apollo: 4.0.0-alpha.8
apollo-client: 2.6.8

Additional context
When the fetch policy is set to cache-and-network or network-only, it fetches twice as described. However, it works as expected after any variable changes afterwards on the mentioned fetch policies.

On other fetch policies, it seems to be ignored even after variables changes. Is this intended?

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