Skip to content

Commit

Permalink
fix(reactivity): enhance reactive function to handle the WeakMap key
Browse files Browse the repository at this point in the history
  • Loading branch information
邹浩明 committed Feb 8, 2025
1 parent 119f18c commit 11682e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/reactivity/src/reactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ function createReactiveObject(
) {
return target
}
// target already has corresponding Proxy
const existingProxy = proxyMap.get(target)
if (existingProxy) {
return existingProxy
}
// only specific value types can be observed.
const targetType = getTargetType(target)
if (targetType === TargetType.INVALID) {
return target
}
// target already has corresponding Proxy
const existingProxy = proxyMap.get(target)
if (existingProxy) {
return existingProxy
}
const proxy = new Proxy(
target,
targetType === TargetType.COLLECTION ? collectionHandlers : baseHandlers,
Expand Down

0 comments on commit 11682e7

Please sign in to comment.