]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): avoid recursive warning
authorEvan You <evan@vuejs.org>
Tue, 16 Jul 2024 10:05:44 +0000 (18:05 +0800)
committerEvan You <evan@vuejs.org>
Tue, 16 Jul 2024 10:05:44 +0000 (18:05 +0800)
close #8074

packages/runtime-core/src/warning.ts

index d130638b6af965d11467e8791921a947427ec7e9..169cdd907ae97c03c0d858b9cfe6e9ea7e90107e 100644 (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 {