Skip to content

Debounce broken in useQuery #1271

@karladler

Description

@karladler

Describe the bug
Setting the debounce option in useQuery seems to have no affect and a query is executed for each variable change

To Reproduce
Steps to reproduce the behaviour:

  1. create any query with composition API using useQuery ...
  2. set debounce option to some seconds e.g. { debounce: 15000 }
  3. load page. GQL query is executed instantly, but should be executed after 15 seconds
  4. change any variable in query
  5. GQL query is again executed instantly, but should be executed after 15 seconds

Expected behaviour
GQL query is always executed instantly, but should be executed after 15 seconds

Versions
vue: 2.6.14
vue-apollo: 3.0.8
@apollo/client: 3.4.16
@vue/apollo-composable: 4.0.0-alpha.15
@vue/apollo-util: 4.0.0-alpha.15

Additional context
Also using graphql codegen, but I checked the generated code and an simple example without codegen too, which should suffice.

example

const { result } = useQuery(getEntitiesDoc, () => ({ uuid: uuidRef.value?.uuid }), { fetchPolicy: 'cache-and-network', debounce: 15000 });

codegen versions:
"@graphql-codegen/add": "^3.1.0",
"@graphql-codegen/cli": "^2.2.1",
"@graphql-codegen/named-operations-object": "^2.1.0",
"@graphql-codegen/typescript-operations": "^2.1.8",
"@graphql-codegen/typescript-vue-apollo": "^3.1.6"

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