Skip to content

Using reactive and shallowReactive on the same target returns the same proxy for both calls. #2843

@lijingfaatcumt

Description

@lijingfaatcumt

Version

3.0.4

Reproduction link

https://jsfiddle.net/vqkho2xt/2/

Steps to reproduce

const origin = {};
const shallowProxy = shallowReactive(origin);
const reactiveProxy = reactive(origin);
console.log(shallowProxy === reactiveProxy);

What is expected?

shallowProxy !== reactiveProxy

What is actually happening?

shallowProxy === reactiveProxy


why reactive and shallowReactive should return diffrent object ?
may there is the situation: we maybe want to get two different Proxy with the same origin object, the proxy named reactiveProxy returned by reactive , the proxy named shallowProxy returned by shallowReactive, we change the origin objects deep property by reactiveProxy can trigger denpendencies of the deep propery, but we change the origin objects deep property by shallowProxy should not trigger denpendencies of the deep propery, in this situation, the implements of the vue3 can not satisfy because of that shallowReactive and reactive return the same proxy with the same origin object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions