-
-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debounce broken in useQuery #1271
Comments
@karladler @Akryum Variant 1 is certainly not in the sense of the inventors. Just comment out the isRestartDebounceSetup check. function restart () {
//if (!isRestartDebounceSetup) updateRestartFn()
debouncedRestart()
} More correct seems an extension at the "watch" near the comment "Applying variables". if (serialized !== currentVariablesSerialized) {
if (currentOptions.value && ( currentOptions.value.throttle || currentOptions.value.debounce)) {
updateRestartFn()
}
currentVariables = value
restart()
} I think the check can be improved or the updateRestartFn logic. |
Here's more info on why this bug happens:
This effectively means that options will only be applied on change, and not when initially calling |
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:
{ debounce: 15000 }
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
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"
The text was updated successfully, but these errors were encountered: