Skip to content

Commit

Permalink
fix(reactivity): avoid tracking internal symbols in has trap
Browse files Browse the repository at this point in the history
fix #1683
  • Loading branch information
yyx990803 committed Jul 23, 2020
1 parent 452edb7 commit 7edfdf7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/reactivity/__tests__/effect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ describe('reactivity/effect', () => {
expect(fnSpy).toHaveBeenCalledTimes(1)
})

it('should trigger all effects when array length is set 0', () => {
it('should trigger all effects when array length is set to 0', () => {
const observed: any = reactive([1])
let dummy, record
effect(() => {
Expand Down
4 changes: 3 additions & 1 deletion packages/reactivity/src/baseHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ function deleteProperty(target: object, key: string | symbol): boolean {

function has(target: object, key: string | symbol): boolean {
const result = Reflect.has(target, key)
track(target, TrackOpTypes.HAS, key)
if (!isSymbol(key) || !builtInSymbols.has(key)) {
track(target, TrackOpTypes.HAS, key)
}
return result
}

Expand Down

0 comments on commit 7edfdf7

Please sign in to comment.