diff --git a/packages/server-renderer/__tests__/ssrSlot.spec.ts b/packages/server-renderer/__tests__/ssrSlot.spec.ts
index 02872274a..4cc7fd97e 100644
--- a/packages/server-renderer/__tests__/ssrSlot.spec.ts
+++ b/packages/server-renderer/__tests__/ssrSlot.spec.ts
@@ -1,4 +1,4 @@
-import { createApp } from 'vue'
+import { createApp, defineAsyncComponent, h } from 'vue'
import { renderToString } from '../src/renderToString'
const components = {
@@ -154,6 +154,38 @@ describe('ssr: slot', () => {
).toBe(`
`)
})
+ // #12438
+ test('async component slot with v-if true', async () => {
+ const Layout = defineAsyncComponent(() =>
+ Promise.resolve({
+ template: `default header
`,
+ }),
+ )
+ const LayoutLoader = {
+ setup(_: any, context: any) {
+ return () => h(Layout, {}, context.slots)
+ },
+ }
+ expect(
+ await renderToString(
+ createApp({
+ components: {
+ LayoutLoader,
+ },
+ template: `
+
+
+
+ new header
+
+
+
+ `,
+ }),
+ ),
+ ).toBe(` new header
`)
+ })
+
// #11326
test('dynamic component slot', async () => {
expect(