Skip to content

Commit

Permalink
refactor: unify seen variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 12, 2021
1 parent 2bd6ea5 commit bd42955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/mixin.ts
Expand Up @@ -149,8 +149,8 @@ export function mixin(Vue: VueConstructor) {
}
}

function customReactive(target: object, visited = new Set()) {
if (visited.has(target)) return
function customReactive(target: object, seen = new Set()) {
if (seen.has(target)) return
if (
!isPlainObject(target) ||
isRef(target) ||
Expand All @@ -166,8 +166,8 @@ export function mixin(Vue: VueConstructor) {
const val = target[k]
defineReactive(target, k, val)
if (val) {
visited.add(val)
customReactive(val, visited)
seen.add(val)
customReactive(val, seen)
}
return
})
Expand Down
4 changes: 2 additions & 2 deletions src/reactivity/reactive.ts
Expand Up @@ -135,11 +135,11 @@ export function observe<T>(obj: T): T {
/**
* Mock __ob__ for object recursively
*/
function mockReactivityDeep(obj: any, seen = new WeakMap<any, boolean>()) {
function mockReactivityDeep(obj: any, seen = new Set()) {
if (seen.has(obj)) return

def(obj, '__ob__', mockObserver(obj))
seen.set(obj, true)
seen.add(obj)

for (const key of Object.keys(obj)) {
const value = obj[key]
Expand Down

0 comments on commit bd42955

Please sign in to comment.