-
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
Reactive objects unwrapped and mutated by the template #500
Comments
That's one of the caveats of the Vue reactivity system, make sure you read the readme |
Then it appears that the change that made it necessary to use setup() {
return {
someModel: useModel()
}
} Now it's necessary to use setup() {
return {
someModel: reactive(useModel())
}
} Which mutates the original model and causes mayhem ;) I guess there is some way around it (maybe destructuring the model?), but it was nice that it worked before. |
Yeah I know, personally I don't like to use the reactive that way, what you can do a deep unwrapping but that needs to be handled in the user land. There's no good solution tbh, in v3 in other hand is not painful |
Man vue is so much worse than React+MobX it's insane |
In v1.0.0-beta.11 and since v1.0.0-beta.7 or maybe later version (haven't checked exactly), I'm seeing weird behavior with my refs being unwrapped in watchers. For example:
When you open the console you'll see that the first time the
watchEffect
is triggered thestate.value
is a ref (RefImpl
). The second time it's just an unwrapped number.It only happens when returning "reactive"
state
to the template.Here is a live demo: https://codesandbox.io/s/lucid-hooks-y48qt?file=/src/App.vue:0-408
The text was updated successfully, but these errors were encountered: