fix(reactivity): avoid tracking internal symbols in has trap

fix #1683
This commit is contained in:
Evan You 2020-07-22 21:19:10 -04:00
parent 452edb73cb
commit 7edfdf7e23
2 changed files with 4 additions and 2 deletions

View File

@ -759,7 +759,7 @@ describe('reactivity/effect', () => {
expect(fnSpy).toHaveBeenCalledTimes(1) 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]) const observed: any = reactive([1])
let dummy, record let dummy, record
effect(() => { effect(() => {

View File

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