@@ -263,6 +263,7 @@ const hasEmptyPayload =
263263 nuxtApp .payload .serverRendered &&
264264 ! Object .keys (nuxtApp .payload .data ?? {}).length
265265const isSpaFallback = shallowRef (hasEmptyPayload && ! nuxtApp .payload .path )
266+ const hasServerContentOnly = shallowRef (hasEmptyPayload && nuxtApp .payload .path === route .path )
266267const isHydratingWithServerContent = shallowRef (
267268 hasEmptyPayload && nuxtApp .payload .path === route .path ,
268269)
@@ -311,7 +312,7 @@ watch(
311312// DOM before Vue's hydration replaces it. This lets us show the server-rendered
312313// HTML as a static snapshot while data refetches, avoiding any visual flash.
313314const serverRenderedHtml = shallowRef <string | null >(
314- isHydratingWithServerContent .value
315+ hasServerContentOnly .value
315316 ? (document .getElementById (' package-article' )?.innerHTML ?? null )
316317 : null ,
317318)
@@ -773,15 +774,15 @@ const showSkeleton = shallowRef(false)
773774 <!-- Scenario 1: SPA fallback — show skeleton (no real content to preserve) -->
774775 <!-- Scenario 2: SSR with missing payload — preserve server DOM, skip skeleton -->
775776 <PackageSkeleton
776- v-if =" isSpaFallback || (!hasEmptyPayload && (showSkeleton || status === 'pending'))"
777+ v-if =" isSpaFallback || (!hasServerContentOnly && (showSkeleton || status === 'pending'))"
777778 />
778779
779780 <!-- During hydration without payload, show captured server HTML as a static snapshot.
780781 This avoids a visual flash: the user sees the server content while data refetches.
781782 v-html is safe here: the content originates from the server's own SSR output,
782783 captured from the DOM before hydration — it is not user-controlled input. -->
783784 <article
784- v-else-if =" isHydratingWithServerContent || (hasEmptyPayload && !pkg && serverRenderedHtml) "
785+ v-else-if =" hasServerContentOnly && !pkg && serverRenderedHtml"
785786 id =" package-article"
786787 :class =" $style.packagePage"
787788 v-html =" serverRenderedHtml"
0 commit comments