Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): pre jobs without an id should run first #7746

Merged
merged 5 commits into from
Aug 19, 2024

Conversation

skirtles-code
Copy link
Contributor

@skirtles-code skirtles-code commented Feb 17, 2023

If watch() is used outside of a component, the job won't be assigned an id. This leads to it running last, after component rendering:

SFC Playground

This is a regression in 3.2.38, introduced by 78c199d. With 3.2.37 the watcher runs first, as expected.

If someone actually wants a 'global' watcher to run after rendering they can use flush: 'post' instead.

In the early 3.0.0 betas, pre jobs were assigned an id of -1, so the default value of Infinity wasn't used. Once the separate pre queue was introduced the id became irrelevant, so it was removed. However, 3.2.38 moved pre jobs back into the main queue. For watch() calls inside components, this assigns the job an actual id, to ensure they are run just before the component's rendering job. But for watch() calls outside components, no id is assigned and it falls back to Infinity.

My change uses -1 as the default id for pre jobs.

SFC Playground - This PR

@sxzz
Copy link
Member

sxzz commented Feb 22, 2023

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Feb 22, 2023

📝 Ran ecosystem CI: Open

suite result
nuxt ✅ success
pinia ✅ success
router ✅ success
test-utils ✅ success
vite-plugin-vue ✅ success
vitepress ✅ success
vue-macros ✅ success
vueuse ✅ success

@github-actions
Copy link

github-actions bot commented Oct 21, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 98.7 kB (-11 B) 37.4 kB (-4 B) 33.7 kB (-15 B)
vue.global.prod.js 156 kB (-11 B) 57.2 kB (-4 B) 50.9 kB (-23 B)

Usages

Name Size Gzip Brotli
createApp 54.2 kB (-11 B) 21 kB (-9 B) 19.2 kB (+51 B)
createSSRApp 58.1 kB (-11 B) 22.6 kB (-7 B) 20.6 kB (-23 B)
defineCustomElement 58.8 kB (-11 B) 22.5 kB (-1 B) 20.5 kB (-5 B)
overall 67.8 kB (-11 B) 26 kB (-5 B) 23.7 kB (+17 B)

Copy link

pkg-pr-new bot commented Aug 17, 2024

commit: 3b04b4a

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@7746

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@7746

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@7746

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@7746

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@7746

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@7746

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@7746

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@7746

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@7746

vue

pnpm add https://pkg.pr.new/vue@7746

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@7746

Open in Stackblitz

@yyx990803 yyx990803 merged commit b332f80 into vuejs:main Aug 19, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants