Skip to content

Commit 45790b1

Browse files
authored
perf: lazily load package documentation (#1580)
1 parent ba87a55 commit 45790b1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/pages/package-docs/[...path].vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const { data: docsData, status: docsStatus } = useLazyFetch<DocsResponse>(
8181
{
8282
watch: [docsUrl],
8383
immediate: shouldFetch.value,
84+
server: false,
8485
default: () => ({
8586
package: packageName.value,
8687
version: resolvedVersion.value ?? '',
@@ -113,7 +114,9 @@ defineOgImageComponent('Default', {
113114
primaryColor: '#60a5fa',
114115
})
115116
116-
const showLoading = computed(() => docsStatus.value === 'pending')
117+
const showLoading = computed(
118+
() => docsStatus.value === 'pending' || (docsStatus.value === 'idle' && docsUrl.value !== null),
119+
)
117120
const showEmptyState = computed(() => docsData.value?.status !== 'ok')
118121
</script>
119122

0 commit comments

Comments
 (0)