From 46c3ab1d714024894fa1d33e495d5d35c7817d4d Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 5 Sep 2024 17:23:31 +0800 Subject: [PATCH] fix(reactivity): make toRaw work on proxies created by proxyRef --- packages/reactivity/src/ref.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index c3104c055f6..a72e52090dd 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -243,7 +243,10 @@ export function toValue(source: MaybeRefOrGetter): T { } const shallowUnwrapHandlers: ProxyHandler = { - get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), + get: (target, key, receiver) => + key === ReactiveFlags.RAW + ? target + : unref(Reflect.get(target, key, receiver)), set: (target, key, value, receiver) => { const oldValue = target[key] if (isRef(oldValue) && !isRef(value)) {