]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(scheduler): improve error handling in job flushing (#13587)
authoredison <daiwei521@126.com>
Wed, 9 Jul 2025 00:44:24 +0000 (08:44 +0800)
committerGitHub <noreply@github.com>
Wed, 9 Jul 2025 00:44:24 +0000 (08:44 +0800)
packages/runtime-core/src/scheduler.ts

index a75eba300f780f4a62b3f5daa2334f3cfff0fdbb..c5b1b23ff7caf2d2c13ef719a69f7c76f8808f77 100644 (file)
@@ -114,12 +114,18 @@ export function queueJob(job: SchedulerJob): void {
   }
 }
 
+const doFlushJobs = () => {
+  try {
+    flushJobs()
+  } catch (e) {
+    currentFlushPromise = null
+    throw e
+  }
+}
+
 function queueFlush() {
   if (!currentFlushPromise) {
-    currentFlushPromise = resolvedPromise.then(flushJobs).catch(e => {
-      currentFlushPromise = null
-      throw e
-    })
+    currentFlushPromise = resolvedPromise.then(doFlushJobs)
   }
 }