Skip to content

Provided values in mixin are not accessible #9213

@Tidyzq

Description

@Tidyzq

Version

2.5.21

Reproduction link

https://codepen.io/anon/pen/oJLdMN

Open the link and see the error message in dev console.

Steps to reproduce

Create two mixins with a provide object using Symbol as it's key field. Then assign these mixins to a component.

What is expected?

The child component can access two provide object without any error.

What is actually happening?

The child component can only access the last provide object, while the first one is undefined.


Diving into the source code, the reason of this issue is that Vue uses Object.keys to iterate over the provide object while merging mixins. However, Object.keys won't return Symbol keys. see the code.
Maybe we should use for ... in loop, which will iterate through Symbol keys correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions