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): handle prop starts with on, but is not an event handler #7872

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Mar 10, 2023

close #7871
This is an edge case where the user uses on-xxx as a prop not an eventHandler, and mergeProps treats it as an event listener. This PR modifies the merging logic only to treat it as an event listener if the prop's value is a function.

@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Mar 10, 2023

📝 Ran ecosystem CI: Open

suite result
naive-ui ❌ failure
nuxt ✅ success
pinia ✅ success
router ✅ success
test-utils ✅ success
vant ✅ success
vite-plugin-vue ✅ success
vitepress ✅ success
vue-macros ✅ success
vuetify ✅ success
vueuse ✅ success

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some similar special cases that might also be worth considering:

Playground

packages/runtime-core/src/vnode.ts Outdated Show resolved Hide resolved
@edison1105 edison1105 changed the title fix(runtime-core): handle props that startsWith on and have an empty value fix(runtime-core): improve merge props Mar 10, 2023
@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Mar 10, 2023

📝 Ran ecosystem CI: Open

suite result
naive-ui ❌ failure
nuxt ❌ failure
pinia ✅ success
router ✅ success
test-utils ✅ success
vant ✅ success
vite-plugin-vue ✅ success
vitepress ✅ success
vue-macros ✅ success
vuetify ✅ success
vueuse ✅ success

@github-actions
Copy link

github-actions bot commented Oct 20, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+44 B) 38 kB (+26 B) 34.2 kB (+17 B)
vue.global.prod.js 159 kB (+44 B) 57.9 kB (+25 B) 51.4 kB (+8 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47 kB (+44 B) 18.3 kB (+18 B) 16.7 kB (+20 B)
createApp 55 kB (+44 B) 21.3 kB (+19 B) 19.4 kB (+30 B)
createSSRApp 59 kB (+44 B) 23 kB (+20 B) 20.9 kB (+5 B)
defineCustomElement 59.8 kB (+44 B) 22.9 kB (+27 B) 20.8 kB (-45 B)
overall 68.7 kB (+44 B) 26.4 kB (+19 B) 24 kB (+2 B)

@skirtles-code
Copy link
Contributor

I think there's a problem here with merging arrays of listeners. e.g.:

Listener c gets discarded because the incoming value is an array.

@edison1105 edison1105 changed the title fix(runtime-core): improve merge props fix(runtime-core): handle prop starts with on, but is not an event handler May 30, 2024
@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented May 30, 2024

📝 Ran ecosystem CI: Open

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

@edison1105 edison1105 added 🔩 p2-edge-case ready for review This PR requires more reviews labels May 30, 2024
Copy link

pkg-pr-new bot commented Oct 16, 2024

Open in Stackblitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/server-renderer

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

@vue/shared

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

@vue/compat

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

vue

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

commit: fa4379e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔩 p2-edge-case ready for review This PR requires more reviews
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Boolean props without a value are not defaulted to true when there is a v-bind applied if they begin with on
3 participants