@@ -15,7 +15,7 @@ import VNode, { createEmptyVNode } from '../vdom/vnode'
15
15
16
16
import { isUpdatingChildComponent } from './lifecycle'
17
17
import type { Component } from 'types/component'
18
- import { setCurrentInstance } from 'v3/currentInstance'
18
+ import { currentInstance , setCurrentInstance } from 'v3/currentInstance'
19
19
import { syncSetupSlots } from 'v3/apiSetup'
20
20
21
21
export function initRender ( vm : Component ) {
@@ -120,11 +120,10 @@ export function renderMixin(Vue: typeof Component) {
120
120
// to the data on the placeholder node.
121
121
vm . $vnode = _parentVnode !
122
122
// render self
123
+ const prevInst = currentInstance
124
+ const prevRenderInst = currentRenderingInstance
123
125
let vnode
124
126
try {
125
- // There's no need to maintain a stack because all render fns are called
126
- // separately from one another. Nested component's render fns are called
127
- // when parent component is patched.
128
127
setCurrentInstance ( vm )
129
128
currentRenderingInstance = vm
130
129
vnode = render . call ( vm . _renderProxy , vm . $createElement )
@@ -148,8 +147,8 @@ export function renderMixin(Vue: typeof Component) {
148
147
vnode = vm . _vnode
149
148
}
150
149
} finally {
151
- currentRenderingInstance = null
152
- setCurrentInstance ( )
150
+ currentRenderingInstance = prevRenderInst
151
+ setCurrentInstance ( prevInst )
153
152
}
154
153
// if the returned array contains only a single node, allow it
155
154
if ( isArray ( vnode ) && vnode . length === 1 ) {
0 commit comments