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): fix warning for missing event handler #11489

Merged
merged 11 commits into from
Aug 7, 2024

Conversation

skirtles-code
Copy link
Contributor

@skirtles-code skirtles-code commented Aug 3, 2024

Fixes #4803
Closes #8268

There is a warning message shown if an emitted event is not declared via emits or props. However, if the event is emitted in kebab-case, the check for a declared prop does not take that into account.

The property keys in propsOptions have been normalized to camelCase, so the warning needs to use camelize when performing the check.

In addition, the warning message should use camelize when suggesting the prop name, so that it matches the usual convention for declaring props.

I've included several examples in the Playgrounds below. Some are more realistic than others, but they should all behave correctly with the changes in this PR:

There is an existing PR for this, #8268, but I think there are problems with the changes proposed there. I've used that PR as the basis for this PR.

benkroeger and others added 11 commits November 8, 2021 09:22
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
This reverts commit d465288da200b79c198d5c50a2bf0347c99a36b7.
event handler props can be defined in camel and kebab cases

Signed-off-by: Benjamin Kroeger <benjamin.kroeger@gmail.com>
Signed-off-by: Benjamin Kroeger <benjamin.kroeger@gmail.com>
Signed-off-by: Benjamin Kroeger <benjamin.kroeger@gmail.com>
Signed-off-by: Benjamin Kroeger <benjamin.kroeger@gmail.com>
Copy link

github-actions bot commented Aug 3, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.1 kB 34.5 kB 31.1 kB
vue.global.prod.js 147 kB 54 kB 48 kB

Usages

Name Size Gzip Brotli
createApp 49.6 kB 19.5 kB 17.8 kB
createSSRApp 53.2 kB 20.9 kB 19.1 kB
defineCustomElement 51.9 kB 20.2 kB 18.5 kB
overall 63.1 kB 24.5 kB 22.3 kB

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

Successfully merging this pull request may close these issues.

Warning when emitting kebab-cased custom event
3 participants