-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Inconsistent behavior using reactive and ref objects #12643
Comments
I am not the authority to say what is to be expected. I feel that the behavior should be the same though, or the documentation should clearly state what the differences are. Having said that, my opinion is:
So IMHO Vue3 is correct and Vue2 is wrong. I will also add that I was using Vue Composition API plugin before migrating to Vue 2.7, and the reactivity behavior changed. |
If things are left as they are, and not considered to be bugs, I would suggest documenting in Vue 2.7 to state: Reactive ObjectsDo not using an empty reactive object, or modify a root property on a reactive object, if you expect to watch for any changes (deep or not). Ref ObjectsUsing a ref object will fire both non-deep and deep watchers when modifying root properties, but this will not occur in Vue 3. In Vue3 only deep watchers will fire unless the entire object is swapped out. |
Version
2.7.4
Reproduction link
Vue 2
codesandbox.io
Vue 3
codesandbox.io
Steps to reproduce
The documentation for Vue 2.7 states there are issues using a reactive array. This report is when using an empty reactive object. Either the documentation and warnings need to be updated, or the implementation corrected.
Because I am using an object, not an array, no warnings are generated.
Here are the differences I get when using Vue 2.7.x versus Vue 3.x:
Vue 3
Vue 2
What is expected?
Watchers/Reactivity should be consistent.
What is actually happening?
Watchers/Reactivity is not consistent.
The text was updated successfully, but these errors were encountered: