File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
server-renderer/__tests__ Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -806,7 +806,7 @@ export function setupComponent(
806806 const { props, children } = instance . vnode
807807 const isStateful = isStatefulComponent ( instance )
808808 initProps ( instance , props , isStateful , isSSR )
809- initSlots ( instance , children , optimized )
809+ initSlots ( instance , children , optimized || isSSR )
810810
811811 const setupResult = isStateful
812812 ? setupStatefulComponent ( instance , isSSR )
Original file line number Diff line number Diff line change 1- import { createApp } from 'vue'
1+ import { createApp , defineAsyncComponent , h } from 'vue'
22import { renderToString } from '../src/renderToString'
33
44const components = {
@@ -154,6 +154,38 @@ describe('ssr: slot', () => {
154154 ) . toBe ( `<div><p>1</p><p>2</p></div>` )
155155 } )
156156
157+ // #12438
158+ test ( 'async component slot with v-if true' , async ( ) => {
159+ const Layout = defineAsyncComponent ( ( ) =>
160+ Promise . resolve ( {
161+ template : `<div><slot name="header">default header</slot></div>` ,
162+ } ) ,
163+ )
164+ const LayoutLoader = {
165+ setup ( _ : any , context : any ) {
166+ return ( ) => h ( Layout , { } , context . slots )
167+ } ,
168+ }
169+ expect (
170+ await renderToString (
171+ createApp ( {
172+ components : {
173+ LayoutLoader,
174+ } ,
175+ template : `
176+ <Suspense>
177+ <LayoutLoader>
178+ <template v-if="true" #header>
179+ new header
180+ </template>
181+ </LayoutLoader>
182+ </Suspense>
183+ ` ,
184+ } ) ,
185+ ) ,
186+ ) . toBe ( `<div><!--[--> new header <!--]--></div>` )
187+ } )
188+
157189 // #11326
158190 test ( 'dynamic component slot' , async ( ) => {
159191 expect (
You can’t perform that action at this time.
0 commit comments