Skip to content

Commit

Permalink
fix(runtime-core): avoid recursive warning
Browse files Browse the repository at this point in the history
close #8074
  • Loading branch information
yyx990803 committed Jul 16, 2024
1 parent 8655ced commit 3ee7b4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/runtime-core/src/warning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export function popWarningContext() {
stack.pop()
}

let isWarning = false

export function warn(msg: string, ...args: any[]) {
if (isWarning) return
isWarning = true

// avoid props formatting or warn handler tracking deps that might be mutated
// during patch, leading to infinite recursion.
pauseTracking()
Expand Down Expand Up @@ -70,6 +75,7 @@ export function warn(msg: string, ...args: any[]) {
}

resetTracking()
isWarning = false
}

export function getComponentTrace(): ComponentTraceStack {
Expand Down

0 comments on commit 3ee7b4c

Please sign in to comment.