2
0
Эх сурвалжийг харах

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

edison 9 сар өмнө
parent
commit
94b2ddc6f9

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