constructor(anchorLabel?: string) {
super([])
- this.parentComponent = currentInstance
if (isHydrating) {
this.anchorLabel = anchorLabel
locateHydrationNode()
}
this.current = key
+ const instance = currentInstance
const prevSub = setActiveSub()
const parent = isHydrating ? null : this.anchor.parentNode
const transition = this.$transition
const mode = transition && transition.mode
if (mode) {
applyTransitionLeaveHooks(this.nodes, transition, () =>
- this.render(render, transition, parent),
+ this.render(render, transition, parent, instance),
)
parent && remove(this.nodes, parent)
if (mode === 'out-in') {
}
}
- this.render(render, transition, parent)
+ this.render(render, transition, parent, instance)
if (this.fallback) {
// set fallback for nested fragments
render: BlockFn | undefined,
transition: VaporTransitionHooks | undefined,
parent: ParentNode | null,
+ instance: GenericComponentInstance | null,
) {
if (render) {
// try to reuse the kept-alive scope
// switch current instance to parent instance during update
// ensure that the parent instance is correct for nested components
let prev
- if (this.parentComponent && parent)
- prev = setCurrentInstance(this.parentComponent)
+ if (parent && instance) prev = setCurrentInstance(instance)
this.nodes = this.scope.run(render) || []
- if (this.parentComponent && parent) setCurrentInstance(...prev!)
+ if (parent && instance) setCurrentInstance(...prev!)
if (transition) {
this.$transition = applyTransitionHooks(this.nodes, transition)