3.0.0-rc.4
P.S. you should use the browser console
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
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?
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.
Anyway I've tried to add a prop: nothing changes.
I tried it and it work fine.
@Picknight could you provide a codesandbox like I did? You can fork mine as well.
Because mine contradics what you are saying, but perhaps you are using a different version of Vue 3 or you are doing something different.
Thanks 馃檪
I can confirm that component seems to be null on chrome 84.0.4147.89 and also has the same behavior in firefox.
Perhaps should this be marked as a possible regression issue?
Sorry, I misunderstood your question. My fault. Let me see what I can do to help you. @jfet97
This is expected behavior.
Directives are meant for DOM manipulations. When they are used on a component, they fallthrough like attributes (e.g. class and style) to the root of the component's sub tree. In this case, the vnode you are getting is the vnode representing the child component's root element, not the vnode representing the component itself.