Skip to content

Commit

Permalink
fix(reactivity): make toRaw work on proxies created by proxyRef
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 5, 2024
1 parent 3116553 commit 46c3ab1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/reactivity/src/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ export function toValue<T>(source: MaybeRefOrGetter<T>): T {
}

const shallowUnwrapHandlers: ProxyHandler<any> = {
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)) {
Expand Down

0 comments on commit 46c3ab1

Please sign in to comment.