mirror of https://github.com/vuejs/core.git
feat(runtime-core): throw real error when scheduler detects infinite loop during dev (#7447)
close #7437
This commit is contained in:
parent
317b783a53
commit
1d79b64ebc
|
@ -1,7 +1,6 @@
|
||||||
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
|
import { ErrorCodes, callWithErrorHandling, handleError } from './errorHandling'
|
||||||
import { Awaited, isArray, NOOP } from '@vue/shared'
|
import { Awaited, isArray, NOOP } from '@vue/shared'
|
||||||
import { ComponentInternalInstance, getComponentName } from './component'
|
import { ComponentInternalInstance, getComponentName } from './component'
|
||||||
import { warn } from './warning'
|
|
||||||
|
|
||||||
export interface SchedulerJob extends Function {
|
export interface SchedulerJob extends Function {
|
||||||
id?: number
|
id?: number
|
||||||
|
@ -271,14 +270,16 @@ function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
|
||||||
if (count > RECURSION_LIMIT) {
|
if (count > RECURSION_LIMIT) {
|
||||||
const instance = fn.ownerInstance
|
const instance = fn.ownerInstance
|
||||||
const componentName = instance && getComponentName(instance.type)
|
const componentName = instance && getComponentName(instance.type)
|
||||||
warn(
|
handleError(
|
||||||
`Maximum recursive updates exceeded${
|
`Maximum recursive updates exceeded${
|
||||||
componentName ? ` in component <${componentName}>` : ``
|
componentName ? ` in component <${componentName}>` : ``
|
||||||
}. ` +
|
}. ` +
|
||||||
`This means you have a reactive effect that is mutating its own ` +
|
`This means you have a reactive effect that is mutating its own ` +
|
||||||
`dependencies and thus recursively triggering itself. Possible sources ` +
|
`dependencies and thus recursively triggering itself. Possible sources ` +
|
||||||
`include component template, render function, updated hook or ` +
|
`include component template, render function, updated hook or ` +
|
||||||
`watcher source function.`
|
`watcher source function.`,
|
||||||
|
null,
|
||||||
|
ErrorCodes.APP_ERROR_HANDLER
|
||||||
)
|
)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue