-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isReadonly
returns false
for computed value (without a set function) nested in a reactive object
#12138
Comments
isReadonly
returns false
for computed value nested in a reactive objectisReadonly
returns false
for computed value (without a set function) nested in a reactive object
This behavior is expected, see https://vuejs.org/api/reactivity-core.html#reactive:
In your case, |
OK with the first point.
Then why |
This is also related to When you try to update |
I think it's kind of contradictory and confusing to have a variable that |
You're right, the current error message doesn't make it clear that this behavior is due to Before: After: |
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
What is expected?
fix(reactivity): mutating a readonly ref nested in a reactive object should fail. (close #5042) #5048
What is actually happening?
isReadonly(ro.c)
returnsfalse
ro.c = undefined
throwsTypeError: 'set' on proxy: trap returned falsish for property 'c'
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: