From 65c7bd149cf9024f8026a73426d51c76be543cc4 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 18 Oct 2023 21:23:19 +0800 Subject: Fix Vue HMR for script tags (#8860) --- packages/integrations/vue/client.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'packages/integrations/vue/client.js') diff --git a/packages/integrations/vue/client.js b/packages/integrations/vue/client.js index 8b2a5eede..7e1d8090e 100644 --- a/packages/integrations/vue/client.js +++ b/packages/integrations/vue/client.js @@ -14,16 +14,20 @@ export default (element) => slots[key] = () => h(StaticHtml, { value, name: key === 'default' ? undefined : key }); } - let content = h(Component, props, slots); - // related to https://github.com/withastro/astro/issues/6549 - // if the component is async, wrap it in a Suspense component - if (isAsync(Component.setup)) { - content = h(Suspense, null, content); - } - const isHydrate = client !== 'only'; - const boostrap = isHydrate ? createSSRApp : createApp; - const app = boostrap({ name, render: () => content }); + const bootstrap = isHydrate ? createSSRApp : createApp; + const app = bootstrap({ + name, + render() { + let content = h(Component, props, slots); + // related to https://github.com/withastro/astro/issues/6549 + // if the component is async, wrap it in a Suspense component + if (isAsync(Component.setup)) { + content = h(Suspense, null, content); + } + return content; + }, + }); await setup(app); app.mount(element, isHydrate); -- cgit v1.2.3