fix: parent chain error when root is functional
This commit is contained in:
parent
832d715afe
commit
01bb8d1894
@ -77,18 +77,17 @@ export function initializeComponentInstance(instance: ComponentInstance) {
|
|||||||
// parent chain management
|
// parent chain management
|
||||||
if (currentContextVNode !== null) {
|
if (currentContextVNode !== null) {
|
||||||
// locate first non-functional parent
|
// locate first non-functional parent
|
||||||
while (
|
while (currentContextVNode !== null) {
|
||||||
currentContextVNode !== null &&
|
if ((currentContextVNode.flags & VNodeFlags.COMPONENT_STATEFUL) > 0) {
|
||||||
currentContextVNode.flags & VNodeFlags.COMPONENT_FUNCTIONAL &&
|
const parentComponent = (currentContextVNode as VNode)
|
||||||
currentContextVNode.contextVNode !== null
|
.children as ComponentInstance
|
||||||
) {
|
instance.$parent = parentComponent.$proxy
|
||||||
currentContextVNode = currentContextVNode.contextVNode as any
|
instance.$root = parentComponent.$root
|
||||||
|
parentComponent.$children.push(proxy)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
currentContextVNode = currentContextVNode.contextVNode
|
||||||
}
|
}
|
||||||
const parentComponent = (currentContextVNode as VNode)
|
|
||||||
.children as ComponentInstance
|
|
||||||
instance.$parent = parentComponent.$proxy
|
|
||||||
instance.$root = parentComponent.$root
|
|
||||||
parentComponent.$children.push(proxy)
|
|
||||||
} else {
|
} else {
|
||||||
instance.$root = proxy
|
instance.$root = proxy
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user