From 26dd6ed447baa7ce002a9cb6dc86e6a79fad30e0 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Tue, 6 Feb 2024 12:02:31 +0100 Subject: [PATCH] fix(vue3): wrap story with Suspense, fix #668 --- packages/histoire-plugin-vue/src/client/app/RenderStory.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/histoire-plugin-vue/src/client/app/RenderStory.ts b/packages/histoire-plugin-vue/src/client/app/RenderStory.ts index b270d810..310a1415 100644 --- a/packages/histoire-plugin-vue/src/client/app/RenderStory.ts +++ b/packages/histoire-plugin-vue/src/client/app/RenderStory.ts @@ -1,6 +1,6 @@ /* eslint-disable vue/one-component-per-file */ -import { App, createApp, onMounted, reactive, Component, h, VNode } from 'vue' +import { App, createApp, onMounted, reactive, Component, h, VNode, Suspense } from 'vue' import { defineComponent as _defineComponent, onBeforeUnmount as _onBeforeUnmount, @@ -118,6 +118,9 @@ export default _defineComponent({ ) } + // Wrap in Suspense to render async components + children.push(h(Suspense, {}, () => children.at(-1))) + return children.at(-1) }, })