Skip to content

Debounce shouldn't apply to the first request of a query #983

Open
@stevelacey

Description

@stevelacey

Describe the bug
The debounce delay should apply only to variable updates/refetches rather than the initial query load – the scenario it's creating for me is that when then passing items and loading into; say, a data table component, you typically end up with a flash of "no items" screen, because loading == false for duration of the initial debounce, and items is probably defaulted to an empty array.

The same can't be said for alternative implementations like apollo-link-debounce, the throttling there is as expected, it applies to subsequent requests only, the first request is immediate.

To Reproduce
Steps to reproduce the behavior:

  1. Set the debounce option on a smart query
  2. Reload the page
  3. Observe that the first request doesn't happen until after the duration of the debounce

Expected behavior
Debounce shouldn't apply to the first request.

Versions
vue: 2.6.10
vue-apollo: 3.0.3
apollo-client: 2.6.4

Additional context
I didn't have much luck setting debounce myself after the initial request, I suspect this doesn't work:

this.$apollo.queries.users.setOptions({ debounce: 250 })

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