Skip to content

Commit 9755f43

Browse files
committed
fix(reactivity): respect readonly during ref unwrapping
1 parent b555f02 commit 9755f43

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/reactivity/src/baseHandlers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
119119

120120
if (isRef(res)) {
121121
// ref unwrapping - skip unwrap for Array + integer key.
122-
return targetIsArray && isIntegerKey(key) ? res : res.value
122+
const value = targetIsArray && isIntegerKey(key) ? res : res.value
123+
return isReadonly && isObject(value) ? readonly(value) : value
123124
}
124125

125126
if (isObject(res)) {

0 commit comments

Comments
 (0)