From: Evan You Date: Tue, 16 Jul 2024 10:05:44 +0000 (+0800) Subject: fix(runtime-core): avoid recursive warning X-Git-Tag: v3.4.32~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ee7b4c7b1374c5bdc50a579b49f6bc15022b085;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): avoid recursive warning close #8074 --- diff --git a/packages/runtime-core/src/warning.ts b/packages/runtime-core/src/warning.ts index d130638b6a..169cdd907a 100644 --- a/packages/runtime-core/src/warning.ts +++ b/packages/runtime-core/src/warning.ts @@ -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 {