Subscribe on changes!

Nested objects in shadowReactive() are still responsive

avatar
Dec 4th 2022

Vue version

3.2.45

Link to minimal reproduction

https://github.com/farmerhy/vue-bug.git

Steps to reproduce

import { shallowReactive } from "vue";

const state = shallowReactive({ foo: 1, nested: { bar: 2 }, }); setTimeout(() => { state.foo++; state.nested.bar++; }, 0);

What is expected?

2

2

What is actually happening?

2

3

System Info

No response

Any additional comments?

This is inconsistent with the description in the document on the official website. If this is normal, the documents on the official website should have a description of it. This is so confusing!

avatar
Dec 4th 2022

That's expected, and the nested object is not "responsive" (you mean reactive), it does not trigger anything. But when the change to foo triggers a component update, the whole template is being updated with all the current state