Преглед изворни кода

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

edison пре 9 месеци
родитељ
комит
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() {
 function queueFlush() {
   if (!currentFlushPromise) {
   if (!currentFlushPromise) {
-    currentFlushPromise = resolvedPromise.then(flushJobs).catch(e => {
-      currentFlushPromise = null
-      throw e
-    })
+    currentFlushPromise = resolvedPromise.then(doFlushJobs)
   }
   }
 }
 }