parent
fa6556a0d5
commit
6493da5bfa
@ -20,7 +20,8 @@ import {
|
|||||||
resolveDynamicComponent,
|
resolveDynamicComponent,
|
||||||
renderSlot,
|
renderSlot,
|
||||||
onErrorCaptured,
|
onErrorCaptured,
|
||||||
onServerPrefetch
|
onServerPrefetch,
|
||||||
|
getCurrentInstance
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import { escapeHtml } from '@vue/shared'
|
import { escapeHtml } from '@vue/shared'
|
||||||
import { renderToString } from '../src/renderToString'
|
import { renderToString } from '../src/renderToString'
|
||||||
@ -779,6 +780,23 @@ function testRender(type: string, render: typeof renderToString) {
|
|||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
expect(`Element is missing end tag`).toHaveBeenWarned()
|
expect(`Element is missing end tag`).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #6110
|
||||||
|
test('reset current instance after rendering error', async () => {
|
||||||
|
const prev = getCurrentInstance()
|
||||||
|
expect(prev).toBe(null)
|
||||||
|
try {
|
||||||
|
await render(
|
||||||
|
createApp({
|
||||||
|
data() {
|
||||||
|
return { msg: null }
|
||||||
|
},
|
||||||
|
template: `<div>{{ msg.text }}</div>`
|
||||||
|
})
|
||||||
|
)
|
||||||
|
} catch {}
|
||||||
|
expect(getCurrentInstance()).toBe(prev)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('serverPrefetch', async () => {
|
test('serverPrefetch', async () => {
|
||||||
|
@ -174,18 +174,21 @@ function renderComponentSubTree(
|
|||||||
|
|
||||||
// set current rendering instance for asset resolution
|
// set current rendering instance for asset resolution
|
||||||
const prev = setCurrentRenderingInstance(instance)
|
const prev = setCurrentRenderingInstance(instance)
|
||||||
ssrRender(
|
try {
|
||||||
instance.proxy,
|
ssrRender(
|
||||||
push,
|
instance.proxy,
|
||||||
instance,
|
push,
|
||||||
attrs,
|
instance,
|
||||||
// compiler-optimized bindings
|
attrs,
|
||||||
instance.props,
|
// compiler-optimized bindings
|
||||||
instance.setupState,
|
instance.props,
|
||||||
instance.data,
|
instance.setupState,
|
||||||
instance.ctx
|
instance.data,
|
||||||
)
|
instance.ctx
|
||||||
setCurrentRenderingInstance(prev)
|
)
|
||||||
|
} finally {
|
||||||
|
setCurrentRenderingInstance(prev)
|
||||||
|
}
|
||||||
} else if (instance.render && instance.render !== NOOP) {
|
} else if (instance.render && instance.render !== NOOP) {
|
||||||
renderVNode(
|
renderVNode(
|
||||||
push,
|
push,
|
||||||
|
Loading…
Reference in New Issue
Block a user