Subscribe on changes!

[reactivity]toRaw behaves inconsistently for objects constructed from prototypes of different reactive object types

avatar
Jul 13th 2022

Vue version

3.2.37

Link to minimal reproduction

https://sfc.vuejs.org/#eNp1kstuwyAQRX9lxMaO5MI+TSpFXVeV2kU3bAiauKTmISCxIsv/XogfcaJ2ZWa49zJHno7snKPnE5I12QTplYsQMJ7cCzdKO+sjdOBRyKjOWEG0H6KFHg7eaiiSrXjmhhvGQFqtrYF4cQgl0prC+/6IMlY778VlxY20JkSwXtXKiOZ1kG/n7LLrVylrUI1h2zGDyqSKWN6bb3Iv2jnvOmE5BEwK2yBtbF0WQ7uo5ge2aYDJnNUjStOkV9U9zptw1SfG6gvFTz7nb6r/IJvdCzqDbU4oV0vIhfA/0EnyALtwTsCPygX0dHUFv1kn+KVzw4YlSL8/FRG1a9JAqdqwuSAVGVbjSQtHj8GatDwdNwB8vAicrOHayb20Jrnm5DtGF9aMhYPMK3cM1PqapRP1JxOVRopBP+29bQP6FMxJjui56Un/C0YJ8vM=

Steps to reproduce

Open the page and look at the console

What is expected?

common === rawCommon should be true

collection === rawCollection should be true

What is actually happening?

common === rawCommon is true

but collection === rawCollection is false

System Info

System:
    OS: Windows 11 22000.675
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700KF
    Memory: 15.89 GB / 31.86 GB
Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
    Chrome: 103 Chromium (103.0.5060.114)
    Internet Explorer: 11.0.22000.120

Any additional comments?

This commit make common === rawCommon is true

Maybe missing the handling of the collection type?

I found that this case is not handled in reactivity/src/collectionHandlers.ts