-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
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.
Avoid using arrays as root values in reactive()
because without property access the array's mutation won't be tracked
(this will result in a warning).
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:
const reactiveData = reactive({});
const refData = ref({});
Vue 3
reactiveData.foo = 'bar'
refData.value.foo = 'bar'
- reactive watcher called
- reactive deep watcher called
- ref watcher NOT called
- ref deep watcher called
Vue 2
set(reactiveData, 'foo', 'bar')
set(refData.value, 'foo', 'bar')
- reactive watcher NOT called
- reactive deep watcher NOT called
- ref watcher called
- ref deep watcher called
What is expected?
Watchers/Reactivity should be consistent.
What is actually happening?
Watchers/Reactivity is not consistent.
quannt-paypay
Metadata
Metadata
Assignees
Labels
No labels