Skip to content

Commit

Permalink
feat(runtime-core): throw real error when scheduler detects infinite …
Browse files Browse the repository at this point in the history
…loop during dev (#7447)

close #7437
  • Loading branch information
smallnine9 authored Dec 19, 2023
1 parent 317b783 commit 1d79b64
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/runtime-core/src/scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
import { ErrorCodes, callWithErrorHandling, handleError } from './errorHandling'
import { Awaited, isArray, NOOP } from '@vue/shared'
import { ComponentInternalInstance, getComponentName } from './component'
import { warn } from './warning'

export interface SchedulerJob extends Function {
id?: number
Expand Down Expand Up @@ -271,14 +270,16 @@ function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
if (count > RECURSION_LIMIT) {
const instance = fn.ownerInstance
const componentName = instance && getComponentName(instance.type)
warn(
handleError(
`Maximum recursive updates exceeded${
componentName ? ` in component <${componentName}>` : ``
}. ` +
`This means you have a reactive effect that is mutating its own ` +
`dependencies and thus recursively triggering itself. Possible sources ` +
`include component template, render function, updated hook or ` +
`watcher source function.`
`watcher source function.`,
null,
ErrorCodes.APP_ERROR_HANDLER
)
return true
} else {
Expand Down

0 comments on commit 1d79b64

Please sign in to comment.