Преглед на файлове

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

edison преди 11 месеца
родител
ревизия
94b2ddc6f9
променени са 1 файла, в които са добавени 10 реда и са изтрити 4 реда
  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)
   }
 }