Skip to content

Commit

Permalink
fix(vanilla): support undefined property in proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Apr 20, 2022
1 parent 2775d1c commit be2be65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ export function proxy<T extends object>(initialObject: T = {} as T): T {
is: Object.is,
canProxy,
set(target: T, prop: string | symbol, value: any, receiver: any) {
const hasPrevValue = Reflect.has(target, prop)
const prevValue = Reflect.get(target, prop, receiver)
if (this.is(prevValue, value)) {
if (hasPrevValue && this.is(prevValue, value)) {
return true
}
const childListeners = prevValue?.[LISTENERS]
Expand Down

0 comments on commit be2be65

Please sign in to comment.