Skip to content

Commit 7edfdf7

Browse files
committed
fix(reactivity): avoid tracking internal symbols in has trap
fix #1683
1 parent 452edb7 commit 7edfdf7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/reactivity/__tests__/effect.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ describe('reactivity/effect', () => {
759759
expect(fnSpy).toHaveBeenCalledTimes(1)
760760
})
761761

762-
it('should trigger all effects when array length is set 0', () => {
762+
it('should trigger all effects when array length is set to 0', () => {
763763
const observed: any = reactive([1])
764764
let dummy, record
765765
effect(() => {

packages/reactivity/src/baseHandlers.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ function deleteProperty(target: object, key: string | symbol): boolean {
142142

143143
function has(target: object, key: string | symbol): boolean {
144144
const result = Reflect.has(target, key)
145-
track(target, TrackOpTypes.HAS, key)
145+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
146+
track(target, TrackOpTypes.HAS, key)
147+
}
146148
return result
147149
}
148150

0 commit comments

Comments
 (0)