Skip to content

isReadonly returns false for computed value (without a set function) nested in a reactive object #12138

Closed
@cloydlau

Description

@cloydlau

Vue version

3.5.11

Link to minimal reproduction

https://play.vuejs.org/#eNqNk19L7DAQxb/KkJd2oXRZvPdl0YV7ZR9UUFEfA1LS6RrtJmGSrruUfncnra2Cf9i3cM6vkzMzTSv+OZfvGhRLceoVaRfAY2jcShq9dZYCtKDs1jUBywy0v8OitKY+ZEBYqKB32J96DTqoyG4h4XqJNNIoa3wAgrMJSdtuNuqK9bF0ms7gbAWLybRstkAZU91UKIrjtalldnBsjXltN+lHupRmM5jPIVCDPzI2P4ai4zB11IXHUHzhO1YVtWdOGj5zCm6+MSVW2mAZ7ZurdycO8osTc/+gf+EfDg7XRJaWkPD2E7AGHNn9YclRC8czDw1FNibS/gkqSxFwSOEAieJln86Hv2clMhE8t1bpTf7sreEfq5UGQIq4a10j3biguXUpltA70Svq2r5e9locTjbq6gnVyzf6s99HTYpbQo+0QykmLxS0wTDY6/tr3PN5Mre2bGqmfzHvkNfSxIwD9p9nxbE/cX3ai/55aLN58Ot9QOPHpobtAnQ9LwW/hvNfWv+Ie5L/6b+TpuMpPu6QYk0e4En+N18sRPcGZ8o72Q==

Steps to reproduce

  1. Open the reproduction link
  2. Check the Console

What is expected?

  1. Computed value (without a set function) is readonly, so maybe those nested in a reactive object should also be readonly, right?
  2. The PR below shows that mutating a readonly ref nested in a reactive object is not allowed, but it's not clear for this case
    fix(reactivity): mutating a readonly ref nested in a reactive object should fail. (close #5042) #5048

What is actually happening?

  1. isReadonly(ro.c) returns false
  2. ro.c = undefined throws TypeError: 'set' on proxy: trap returned falsish for property 'c'

System Info

No response

Any additional comments?

No response

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