We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
enabled
Sometimes vue-query doesn't respect enabled, It happens when enabled changes from true to false
true
false
https://stackblitz.com/edit/vitejs-vite-q1vdvf?file=src%2Fpages%2FPost.vue
1
queryFn
20
According to the enabled condition, when postId is greater than 10, it will be false
postId
10
const enabled = computed(() => { return !!postId.value.id && postId.value.id < 10; });
queryFn should not be called when enabled is false
Sometimes
No response
System: OS: macOS 11.6 CPU: (8) arm64 Apple M1 Memory: 90.47 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm Browsers: Firefox: 116.0.2 Safari: 14.1.2 Safari Technology Preview: 15.4 npmPackages: vue: ^3.3.4 => 3.3.4
None
v4.34.3
v5.2.2
I guess it is because { flush:'sync' } caused the current issue. The following are relevant references.
{ flush:'sync' }
computed
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
Sometimes vue-query doesn't respect
enabled
, It happens whenenabled
changes fromtrue
tofalse
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-q1vdvf?file=src%2Fpages%2FPost.vue
Steps to reproduce
1
, andqueryFn
will be executed.20
, andqueryFn
will be executed.According to the
enabled
condition, whenpostId
is greater than10
, it will befalse
Expected behavior
queryFn
should not be called whenenabled
isfalse
How often does this bug happen?
Sometimes
Screenshots or Videos
No response
Platform
Tanstack Query adapter
None
TanStack Query version
v4.34.3
TypeScript version
v5.2.2
Additional context
I guess it is because
{ flush:'sync' }
caused the current issue. The following are relevant references.computed
triggers watcher of sync twice vuejs/core#9149The text was updated successfully, but these errors were encountered: