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 }