Skip to content

Inject option in mixin no longer works #6093

Closed
@kasperisager

Description

@kasperisager

Version

2.4.1

Reproduction link

https://jsfiddle.net/d92sL0zy/2/

Steps to reproduce

  1. Create mixin that sets the inject option
  2. Create component that uses said mixin
  3. Use component in context with a corresponding provide

What is expected?

The data provided in the context is correctly injected into the component that uses the mixin with the inject option set.

What is actually happening?

The data provided is not injected into the component that uses the mixin, unless the inject option is specified directly on the component and not in the mixin.


I use the pattern of specifying provide and inject options on mixins extensively, as this provides some really useful mixins for specifying relationships between different components. A component using a hasOne() mixin would for example provide itself to a child which would then use a memberOf() mixin to inject the parent. As of Vue 2.4.0 , this however no longer works as the inject option of the memberOf() mixin is ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions