Skip to content

Known events aren't removed from $attrs #2599

@jods4

Description

@jods4

Version

3.0.2

Reproduction link

https://jsfiddle.net/pqte0h2s/

Steps to reproduce

Just like declared $props are removed from $attrs and are never inherited,
declared $emits should also be removed from $attrs.

It looks like they aren't and this can cause unexpected behaviors.
In the linked repro, try to type in the input box. The outer y variable shouldn't change.

What is expected?

y shouldn't change, because the C1 component doesn't raise update:modelValue event.

onUpdateModelValue can be found in $attrs, which I wouldn't expect.

What is actually happening?

y is updated, because the app @update:modelValue event was put into $attrs, which the C1 component passes down to input.

Only unknown events (that are not declared in emits) should be found in $attrs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions