Skip to content

Commit 4660e64

Browse files
committed
fix: polish ssr result preview for scenario 2
1 parent bb4015b commit 4660e64

3 files changed

Lines changed: 3 additions & 53 deletions

File tree

app/composables/npm/usePackage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ export function usePackage(
156156
const asyncData = useLazyAsyncData(
157157
() => `package:${toValue(name)}:${toValue(requestedVersion) ?? ''}`,
158158
async ({ $npmRegistry }, { signal }) => {
159-
console.log('fetching package')
160159
const encodedName = encodePackageName(toValue(name))
161160
const { data: r, isStale } = await $npmRegistry<Packument>(`/${encodedName}`, {
162161
signal,

app/pages/package/[[org]]/[name].vue

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -275,52 +275,6 @@ const isHydratingWithServerContent = shallowRef(
275275
)
276276
const hasServerContentOnly = shallowRef(hasEmptyPayload && nuxtApp.payload.path === route.path)
277277
278-
watch(
279-
[
280-
() => hasEmptyPayload,
281-
() => hasServerContentOnly.value,
282-
() => isSpaFallback.value,
283-
() => isHydratingWithServerContent.value,
284-
() => status.value,
285-
() => pkg.value,
286-
() => readmeData.value,
287-
() => Object.keys(nuxtApp.payload.data ?? {}).length,
288-
() => resolvedVersion.value,
289-
() => requestedVersion.value,
290-
],
291-
([
292-
hasEmptyPayloadArg,
293-
hasServerContentOnlyArg,
294-
isSpaFallbackArg,
295-
isHydratingWithServerContentArg,
296-
statusArg,
297-
pkgArg,
298-
readmeDataArg,
299-
dataLengthArg,
300-
resolvedVersionArg,
301-
requestedVersionArg,
302-
]) => {
303-
console.log('main bunch', {
304-
hasEmptyPayloadArg,
305-
hasServerContentOnlyArg,
306-
isSpaFallbackArg,
307-
isHydratingWithServerContentArg,
308-
statusArg,
309-
pkgArg,
310-
readmeDataArg,
311-
dataLengthArg,
312-
resolvedVersionArg,
313-
requestedVersionArg,
314-
})
315-
},
316-
)
317-
watch(
318-
() => nuxtApp.payload.data,
319-
data => {
320-
console.log('nuxtApp.payload.data', data, Object.keys(data ?? {}))
321-
},
322-
{ immediate: true },
323-
)
324278
// When we have server-rendered content but no payload data, capture the server
325279
// DOM before Vue's hydration replaces it. This lets us show the server-rendered
326280
// HTML as a static snapshot while data refetches, avoiding any visual flash.
@@ -793,7 +747,9 @@ const showSkeleton = shallowRef(false)
793747
<!-- During hydration without payload, show captured server HTML as a static snapshot.
794748
This avoids a visual flash: the user sees the server content while data refetches.
795749
v-html is safe here: the content originates from the server's own SSR output,
796-
captured from the DOM before hydration — it is not user-controlled input. -->
750+
captured from the DOM before hydration — it is not user-controlled input.
751+
We also show SSR output until critical data is loaded, so that after rendering dynamic
752+
content, the user receives the same result as he received from the server-->
797753
<article
798754
v-else-if="
799755
isHydratingWithServerContent ||

app/plugins/fix.client.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ export default defineNuxtPlugin({
1414
!Object.keys(nuxtApp.payload.data).length
1515
) {
1616
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
17-
console.log(
18-
'refreshing nuxt data',
19-
nuxtApp.payload.data,
20-
Object.keys(nuxtApp.payload.data ?? {}),
21-
)
2217
refreshNuxtData()
2318
})
2419
}

0 commit comments

Comments
 (0)