-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
watchEffect can't track async reactive value #2093
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
Comments
This is expected, it's necessary for the watcher to collect dependencies synchronously. As you mentioned, you can still read properties outside of the asynchronous code (or before an |
Small side effect of this: you can use an I had this situation where a In the following example, const myReactiveObject = reactive({
firstProp: '',
secondProp: '',
thirdProp: ''
});
watchEffect(async () => {
const { firstProp, secondProp } = myReactiveObject;
await nextTick();
myRef.value = await fetchData({
firstProp,
secondProp,
thirdProp: myReactiveObject.thirdProp,
});
}); I then decided to use |
Version
3.0.0-rc.10
Reproduction link
https://codepen.io/zenheart/pen/jOqzZwV
Steps to reproduce
What is expected?
make watchEffect has an async operation, also can track the reactive value
What is actually happening?
watchEffect can't track reactive value in async operation
The text was updated successfully, but these errors were encountered: