Skip to content

Commit 393b0f9

Browse files
committed
perf: prefetch on visibility by default
1 parent 1c86861 commit 393b0f9

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

app/components/PackageCard.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ defineProps<{
88
headingLevel?: 'h2' | 'h3'
99
/** Whether to show the publisher username */
1010
showPublisher?: boolean
11+
prefetch?: boolean
1112
}>()
1213
1314
function formatDate(dateStr: string): string {
@@ -23,6 +24,7 @@ function formatDate(dateStr: string): string {
2324
<article class="group card-interactive">
2425
<NuxtLink
2526
:to="`/package/${result.package.name}`"
27+
:prefetch-on="prefetch ? 'visibility' : 'interaction'"
2628
class="block focus:outline-none decoration-none"
2729
>
2830
<header class="flex items-start justify-between gap-4 mb-2">

nuxt.config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ export default defineNuxtConfig({
5252
viteEnvironmentApi: true,
5353
viewTransition: true,
5454
typedPages: true,
55-
defaults: {
56-
nuxtLink: {
57-
prefetchOn: {
58-
interaction: true,
59-
visibility: false,
60-
},
61-
},
62-
},
6355
},
6456

6557
compatibilityDate: '2024-04-03',

0 commit comments

Comments
 (0)