Kaynağa Gözat

fix(scheduler): improve error handling in job flushing (#13587)

edison 9 ay önce
ebeveyn
işleme
94b2ddc6f9
1 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 10 4
      packages/runtime-core/src/scheduler.ts

+ 10 - 4
packages/runtime-core/src/scheduler.ts

@@ -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)
   }
 }