expect(obj.r).toBe(ro)
expect(r.value).toBe(ro)
})
+
+ test('should keep nested ref readonly', () => {
+ const items = ref(['one', 'two', 'three'])
+ const obj = {
+ o: readonly({
+ items,
+ }),
+ }
+ expect(isReadonly(obj.o.items)).toBe(true)
+ })
})
test('should be able to trigger with triggerRef', () => {
if (isRef(res)) {
// ref unwrapping - skip unwrap for Array + integer key.
- return targetIsArray && isIntegerKey(key) ? res : res.value
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value
+ return isReadonly && isObject(value) ? readonly(value) : value
}
if (isObject(res)) {