Skip to content

'toRaw' ignores '__v_skip', which could cause errors when adding a custom proxy to a reactive object, despite marking the Proxy with 'markRaw' #4632

@Pentadome

Description

@Pentadome

Version

3.2.12

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. Make a reactive object.
  2. Make a Proxy where the getter always returns another Proxy.
  3. Mark Proxy as raw with markRaw.
  4. Add Proxy to reactive object.

What is expected?

No error.

What is actually happening?

toRaw gets stuck in a loop after adding the proxy to the reactive object.


Workaround:
Dont use markRaw and use shallowReactive instead of reactive.

Possible solution proposals:

  1. Change toRaw to check for the property '__v_skip' and instantly return it's argument when the property is true.

  2. Use WeakMap to keep track of Reactive properties instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions