Skip to content

fix(scheduler): improve error recovery#14541

Open
yangmingshan wants to merge 7 commits intovuejs:minorfrom
yangmingshan:scheduler
Open

fix(scheduler): improve error recovery#14541
yangmingshan wants to merge 7 commits intovuejs:minorfrom
yangmingshan:scheduler

Conversation

@yangmingshan
Copy link
Contributor

@yangmingshan yangmingshan commented Mar 7, 2026

This PR improves the error recovery on jobs flush, and with two other changes:

  1. recursive post jobs can't be re-queued by other jobs.
  2. reset currentFlushPromise only when no jobs are left to flush, to avoid unnecessary microtask.

There are two possible issues:

  1. jobs may left on queue when flushPreFlushCbs or flushPostFlushCbs errors.
  2. flushPreFlushCbs does not check the DISPOSED flag, not sure if it's intentional.

This PR is based on minor, let me know if I should change to main.

@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fad6c477-a5c6-45ae-9be6-ff100aa1d802

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 7, 2026

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14541
npm i https://pkg.pr.new/@vue/compiler-core@14541
yarn add https://pkg.pr.new/@vue/compiler-core@14541.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14541
npm i https://pkg.pr.new/@vue/compiler-dom@14541
yarn add https://pkg.pr.new/@vue/compiler-dom@14541.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14541
npm i https://pkg.pr.new/@vue/compiler-sfc@14541
yarn add https://pkg.pr.new/@vue/compiler-sfc@14541.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14541
npm i https://pkg.pr.new/@vue/compiler-ssr@14541
yarn add https://pkg.pr.new/@vue/compiler-ssr@14541.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@14541
npm i https://pkg.pr.new/@vue/compiler-vapor@14541
yarn add https://pkg.pr.new/@vue/compiler-vapor@14541.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14541
npm i https://pkg.pr.new/@vue/reactivity@14541
yarn add https://pkg.pr.new/@vue/reactivity@14541.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14541
npm i https://pkg.pr.new/@vue/runtime-core@14541
yarn add https://pkg.pr.new/@vue/runtime-core@14541.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14541
npm i https://pkg.pr.new/@vue/runtime-dom@14541
yarn add https://pkg.pr.new/@vue/runtime-dom@14541.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@14541
npm i https://pkg.pr.new/@vue/runtime-vapor@14541
yarn add https://pkg.pr.new/@vue/runtime-vapor@14541.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14541
npm i https://pkg.pr.new/@vue/server-renderer@14541
yarn add https://pkg.pr.new/@vue/server-renderer@14541.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14541
npm i https://pkg.pr.new/@vue/shared@14541
yarn add https://pkg.pr.new/@vue/shared@14541.tgz

vue

pnpm add https://pkg.pr.new/vue@14541
npm i https://pkg.pr.new/vue@14541
yarn add https://pkg.pr.new/vue@14541.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14541
npm i https://pkg.pr.new/@vue/compat@14541
yarn add https://pkg.pr.new/@vue/compat@14541.tgz

commit: ca98adc

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 86.4 kB 30.2 kB 26.6 kB
runtime-dom.global.prod.js 110 kB (+122 B) 41.6 kB (+20 B) 37.4 kB (+71 B)
vue.global.prod.js 170 kB (+122 B) 61.4 kB (+19 B) 54.8 kB (+62 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 50.4 kB (+119 B) 19.7 kB (+15 B) 17.9 kB (-26 B)
createApp 59.4 kB (+119 B) 23 kB (+13 B) 20.9 kB (+10 B)
createApp + vaporInteropPlugin 83.6 kB (+122 B) 30.9 kB (+18 B) 28 kB (+61 B)
createVaporApp 29 kB (+118 B) 11.2 kB (+22 B) 10.3 kB (+23 B)
createSSRApp 63.7 kB (+122 B) 24.7 kB (+30 B) 22.5 kB (+41 B)
createVaporSSRApp 32.4 kB (+118 B) 12.5 kB (+23 B) 11.4 kB (+24 B)
defineCustomElement 65.4 kB (+120 B) 24.8 kB (+31 B) 22.6 kB (+54 B)
defineVaporCustomElement 39.2 kB (+117 B) 14.5 kB (+26 B) 13.3 kB (+21 B)
overall 74.3 kB (+121 B) 28.3 kB (+24 B) 25.7 kB (+4 B)

@yangmingshan yangmingshan changed the title fix(scheduler): align post-flush and flush fix(scheduler): improve error recovery Mar 8, 2026
@edison1105
Copy link
Member

edison1105 commented Mar 9, 2026

Thanks for the PR. LGTM.

jobs may left on queue when flushPreFlushCbs or flushPostFlushCbs errors.

fixed via 87742a8

flushPreFlushCbs does not check the DISPOSED flag, not sure if it's intentional.

flushPreFlushCbs() does not check for DISPOSED, mainly because there is no built-in path in the current runtime to mark pre-watcher jobs with this flag.

pre-jobs actually have only one source: watch(..., { flush: 'pre' }), which is enqueued via queueJob(job, ..., true). When a component is unmounted, scope.stop() is called on its scope first. Even if a watch job remains in the queue after the effect is stopped, its execution becomes a no-op because this.dirty is no longer truthy. It is bypassed not by checking DISPOSED, but because the effect itself has been invalidated.

@edison1105
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Mar 9, 2026

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools failure failure
radix-vue success success
primevue success success
test-utils failure success
pinia success success
vant success failure
vitepress success success
quasar success success
router success success
vueuse failure success
vite-plugin-vue success success
vue-simple-compiler success success
vue-macros failure success
nuxt failure success
vuetify failure success
vue-i18n failure success

@edison1105 edison1105 added the ready to merge The PR is ready to be merged. label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge The PR is ready to be merged. version: minor

Projects

Status: Ready To Merge

Development

Successfully merging this pull request may close these issues.

3 participants