Skip to content

Readonly breaks reactive class instance #12574

@johannes-z

Description

@johannes-z

Version

2.7.0-beta.5

Reproduction link

https://github.com/johannes-z/repro_vite-plugin-vue2-templates/tree/bug/vue-2.7-beta-readonly

See src/dev.ts

Steps to reproduce

git clone https://github.com/johannes-z/repro_vite-plugin-vue2-templates/
git checkout bug/vue-2.7-beta-readonly
pnpm install
pnpm run dev

What is expected?

this.data.complex.log() should log log to console.

What is actually happening?

this.data.complex.log is not a function is printed.


Passing a complex object (e.g. instance of an ES6 class) to readonly(...) breaks the prototype. If you remove readonly and only return data, it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions