From 200bf3589a7c44ce59a60b9184dbe247ee175d14 Mon Sep 17 00:00:00 2001 From: Yasser Lahbibi Date: Sun, 20 Oct 2024 13:22:21 +0200 Subject: [PATCH] fix: use component html string inside payload --- packages/nuxt/src/app/components/nuxt-island.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/app/components/nuxt-island.ts b/packages/nuxt/src/app/components/nuxt-island.ts index 5d353c8375..e17304c3e0 100644 --- a/packages/nuxt/src/app/components/nuxt-island.ts +++ b/packages/nuxt/src/app/components/nuxt-island.ts @@ -126,11 +126,11 @@ export default defineComponent({ } } - const ssrHTML = ref('') + const key = `${props.name}_${hashId.value}` + const ssrHTML = ref(nuxtApp.payload.data[key]?.html || '') - if (import.meta.client && instance.vnode?.el) { + if (import.meta.client && instance.vnode?.el && !ssrHTML.value) { ssrHTML.value = getFragmentHTML(instance.vnode.el, true)?.join('') || '' - const key = `${props.name}_${hashId.value}` nuxtApp.payload.data[key] ||= {} nuxtApp.payload.data[key].html = ssrHTML.value }