Skip to content

vnode.component is null, inside a custom directive's hooks, when it is used onto a Vue component #1700

@jfet97

Description

@jfet97

Version

3.0.0-rc.4

Reproduction links

codesandbox
codepen

P.S. you should use the browser console

Steps to reproduce

  1. Create a custom directive
  2. Use it onto a Vue component, logging the arguments of the directive's hooks
  3. Expand the vnodes inside the browser console, .component will be null

What is expected?

Is vnode.component the v3 corresponding of v2 vnode.componentInstance, isn't it?
If a custom directive is used onto a Vue component, the vnode.component shouldn't be a reference to it?

What is actually happening?

It is null 😕


Maybe is related to the fact that v3 allows more than one root node, but as you can see the problem persists when there is only one root node as well.

For the sake of completeness, here it is a codepen where v2 is used and vnode.componentInstance is what it is expected.
I don't know why, but you have to keep the codepen console open to properly see the logged vnodes inside the browser console.

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