-
Notifications
You must be signed in to change notification settings - Fork 344
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
Can't Set Reactive Property Asynchronously #487
Comments
@bendytree Try not returning a reactive object as it will be destructured at that point (and therefore lose reactivity) but rather return an object with refs inside - or even have your reactive object within the returned object. |
Thanks @danielroe - I should have mentioned it does work if you add |
Confirmed as a bug, the top-level reactive return is not be handled correctly. If you change to this it will work setup() {
const state = reactive({ count: 1 });
setTimeout(() => {
state.count = 2;
}, 1);
return { state };
} Working on the fix |
* fix(setup): handle updates for directly return a reactive object, fix #487 * chore: type fix
Apologies if I'm totally missing something here but can't get reactivity to work. For example:
In Vue 3 this works. Count is updated to 2:
https://jsfiddle.net/8ogjahcb/
In composition-api (v1.0.0-beta.10) count never gets updated. It stays at 1.
https://jsfiddle.net/msrz7w4e/
This example was inspired by the Vue 3 docs.
The text was updated successfully, but these errors were encountered: