Skip to content

Commit e95239c

Browse files
committed
Revert "[Link] Add prefetch="auto" option"
This reverts commit 6a588d5.
1 parent f3f0a03 commit e95239c

File tree

10 files changed

+6
-141
lines changed

10 files changed

+6
-141
lines changed

packages/next/src/client/app-dir/link.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ type InternalLinkProps = {
133133
* Prefetching is only enabled in production.
134134
*
135135
* - In the **App Router**:
136-
* - `"auto"`, `null`, `undefined` (default): Prefetch behavior depends on static vs dynamic routes:
136+
* - `null` (default): Prefetch behavior depends on static vs dynamic routes:
137137
* - Static routes: fully prefetched
138138
* - Dynamic routes: partial prefetch to the nearest segment with a `loading.js`
139139
* - `true`: Always prefetch the full route and data.
@@ -151,7 +151,7 @@ type InternalLinkProps = {
151151
* </Link>
152152
* ```
153153
*/
154-
prefetch?: boolean | 'auto' | null
154+
prefetch?: boolean | null
155155

156156
/**
157157
* (unstable) Switch to a dynamic prefetch on hover. Effectively the same as
@@ -366,9 +366,7 @@ export default function LinkComponent(
366366
* - 'unstable_dynamicOnHover': this starts in "auto" mode, but switches to "full" when the link is hovered
367367
*/
368368
const appPrefetchKind =
369-
prefetchProp === null || prefetchProp === 'auto'
370-
? PrefetchKind.AUTO
371-
: PrefetchKind.FULL
369+
prefetchProp === null ? PrefetchKind.AUTO : PrefetchKind.FULL
372370

373371
if (process.env.NODE_ENV !== 'production') {
374372
function createPropError(args: {

packages/next/src/client/form-shared.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type InternalFormProps = {
1919
* Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.
2020
*
2121
* Options:
22-
* - "auto", null, undefined (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.
22+
* - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.
2323
* - `false`: This will not prefetch any data.
2424
*
2525
* In pages dir, prefetching is not supported, and passing this prop will emit a warning.

packages/next/src/client/link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type InternalLinkProps = {
7373
* Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.
7474
*
7575
* In App Router:
76-
* - "auto", null, undefined (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.
76+
* - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.
7777
* - `true`: This will prefetch the full React Server Component data for all route segments, regardless of whether they contain a segment with `loading.js`.
7878
* - `false`: This will not prefetch any data, even on hover.
7979
*
@@ -82,7 +82,7 @@ type InternalLinkProps = {
8282
* - `false`: Prefetching will not happen when entering the viewport, but will still happen on hover.
8383
* @defaultValue `true` (pages router) or `null` (app router)
8484
*/
85-
prefetch?: boolean | 'auto' | null
85+
prefetch?: boolean | null
8686
/**
8787
* The active locale is automatically prepended. `locale` allows for providing a different locale.
8888
* When `false` `href` has to include the locale as the default behavior is disabled.

test/e2e/app-dir/segment-cache/prefetch-auto/app/dynamic/loading.tsx

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/app/dynamic/page.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/app/layout.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/app/page.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/components/link-accordion.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/next.config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/e2e/app-dir/segment-cache/prefetch-auto/prefetch-auto.test.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)