fix(runtime-core): avoid recursive warning

close #8074
This commit is contained in:
Evan You 2024-07-16 18:05:44 +08:00
parent 8655ced480
commit 3ee7b4c7b1
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 6 additions and 0 deletions

View File

@ -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()
@ -70,6 +75,7 @@ export function warn(msg: string, ...args: any[]) {
}
resetTracking()
isWarning = false
}
export function getComponentTrace(): ComponentTraceStack {