mirror of https://github.com/vuejs/core.git
refactor(scheduler): simplify checkRecursiveUpdates (#11856)
This commit is contained in:
parent
f80d447c17
commit
48613bb928
|
|
@ -267,27 +267,23 @@ function flushJobs(seen?: CountMap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
|
function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
|
||||||
if (!seen.has(fn)) {
|
const count = seen.get(fn) || 0
|
||||||
seen.set(fn, 1)
|
if (count > RECURSION_LIMIT) {
|
||||||
} else {
|
const instance = fn.i
|
||||||
const count = seen.get(fn)!
|
const componentName = instance && getComponentName(instance.type)
|
||||||
if (count > RECURSION_LIMIT) {
|
handleError(
|
||||||
const instance = fn.i
|
`Maximum recursive updates exceeded${
|
||||||
const componentName = instance && getComponentName(instance.type)
|
componentName ? ` in component <${componentName}>` : ``
|
||||||
handleError(
|
}. ` +
|
||||||
`Maximum recursive updates exceeded${
|
`This means you have a reactive effect that is mutating its own ` +
|
||||||
componentName ? ` in component <${componentName}>` : ``
|
`dependencies and thus recursively triggering itself. Possible sources ` +
|
||||||
}. ` +
|
`include component template, render function, updated hook or ` +
|
||||||
`This means you have a reactive effect that is mutating its own ` +
|
`watcher source function.`,
|
||||||
`dependencies and thus recursively triggering itself. Possible sources ` +
|
null,
|
||||||
`include component template, render function, updated hook or ` +
|
ErrorCodes.APP_ERROR_HANDLER,
|
||||||
`watcher source function.`,
|
)
|
||||||
null,
|
return true
|
||||||
ErrorCodes.APP_ERROR_HANDLER,
|
|
||||||
)
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
seen.set(fn, count + 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
seen.set(fn, count + 1)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue