Subscribe on changes!

Mutating a non reactive object after mutating a reactive one, applies the mutation to the reactive one as well

avatar
Apr 19th 2023

Vue version

3.2.47

Link to minimal reproduction

https://play.vuejs.org/#eNqdksFOwzAMhl/F6qWbJlbOU4ZAnDjBgWMva8hExupEaVqBqr47Trq02daC4BbH9vf/st0mD1qvm1okm4RV3EhtoRK21nc5ylIrY6EFI3bcykZAB3ujSkipPs0RIEeusLKgigNsqZCrGu0GbrscQ0ob9flFycBYUO3Spfc10odCkMiNKAXa5+Lw6ACLJaGobO1xqxUQzmldd7w4+NjjtX7vIp3Xd4G+2fW5ukjOhWekHH824GDEDKiL3gs2oVjWD5pGTIEVpT7urKAIgL3Jxj/o6VbgHgBZBqjwJoyQFWZIDewNtNHQoPOWiZIFzDlvihUZ97QonuCd4qK2liZyz4+Sf2zTq2WmA/4ppEabgdlDgtE55LjtKWjk9m/Y+Bxm3IKlgl7hH5ZP9zFruqeTzASbZf1FsCy6k6T7BidrREw=

Steps to reproduce

Click the Increment obj.count button, then click the Increment proxy.count button.

Then click Increment obj then proxy, Increment proxy then obj.

What is expected?

Mutating a non reactive object shouldn't affect the reactive proxy.

What is actually happening?

Mutating a non-reactive object, stores the mutation and applies it when the proxy is mutated.

System Info

No response

Any additional comments?

No response

avatar
Apr 19th 2023

The reactive proxy reads from and writes to the nonreactive original. That's how it works.