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

Mixins trigger an emitted event warning #2651

Closed
skirtles-code opened this issue Nov 20, 2020 · 0 comments
Closed

Mixins trigger an emitted event warning #2651

skirtles-code opened this issue Nov 20, 2020 · 0 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working

Comments

@skirtles-code
Copy link
Contributor

Version

3.0.2

Reproduction link

https://jsfiddle.net/skirtle/yofbtL0h/

Steps to reproduce

  1. Click the button. Note the warning.
  2. Remove the line app.mixin({}) and re-run the Fiddle.
  3. Clicking the button no longer triggers a warning.

What is expected?

No warning, even with the mixin.

What is actually happening?

[Vue warn]: Component emitted event "update:modelValue" but it is neither
declared in the emits option nor as an "onUpdate:modelValue" prop.

The warning is only supposed to be shown when the emits option is specified. Nothing in this example specifies an emits option, so it shouldn't be shown.

The same problem occurs when using the mixins or extends options.

I believe it's caused by an inconsistency in normalizeEmitsOptions:

https://github.com/vuejs/vue-next/blob/2707cbf36e39ff2a54d84fc82ea62d2dc3af5b05/packages/runtime-core/src/componentEmits.ts#L152

Without the mixin it returns null. With the mixin it returns an empty object, which is enough to trigger the warning.

Originally observed in vuejs/docs#702

@LinusBorg LinusBorg added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Dec 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants