Unverified Commit f2603289 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

BREAKING CHANGE: Enable newNextLinkBehavior (#41459)

- Enable newNextLinkBehavior. See #36436 
- Run next/link codemod on test suite

Note that from when this lands on apps trying canary will need to run
the new-link codemod in order to upgrade.
Ideally we have to detect `<a>` while rendering the new link and warn
for it.
Co-authored-by: 's avatarSteven <steven@ceriously.com>
parent f5cb7bd8
...@@ -19,6 +19,30 @@ Codemods are transformations that run on your codebase programmatically. This al ...@@ -19,6 +19,30 @@ Codemods are transformations that run on your codebase programmatically. This al
## Next.js 13 ## Next.js 13
### `new-link`
Safely removes `<a>` from `next/link` or adds `legacyBehavior` prop.
For example:
```jsx
export default function Page() {
return (
<Link href="/about">
<a>About Us</a>
</Link>
)
}
```
Transforms into:
```jsx
export default function Page() {
return <Link href="/about">About Us</Link>
}
```
### `next-image-to-legacy-image` ### `next-image-to-legacy-image`
Safely migrates existing Next.js 10, 11, 12 applications importing `next/image` to the renamed `next/legacy/image` import in Next.js 13. Safely migrates existing Next.js 10, 11, 12 applications importing `next/image` to the renamed `next/legacy/image` import in Next.js 13.
......
...@@ -233,7 +233,7 @@ import Link from 'next/link' ...@@ -233,7 +233,7 @@ import Link from 'next/link'
export default function IndexPage(props) { export default function IndexPage(props) {
return ( return (
<Link href="/another" locale="fr"> <Link href="/another" locale="fr">
<a>To /fr/another</a> To /fr/another
</Link> </Link>
) )
} }
...@@ -279,7 +279,7 @@ import Link from 'next/link' ...@@ -279,7 +279,7 @@ import Link from 'next/link'
export default function IndexPage(props) { export default function IndexPage(props) {
return ( return (
<Link href="/fr/another" locale={false}> <Link href="/fr/another" locale={false}>
<a>To /fr/another</a> To /fr/another
</Link> </Link>
) )
} }
......
...@@ -35,9 +35,7 @@ For example, using `/about` will automatically become `/docs/about` when `basePa ...@@ -35,9 +35,7 @@ For example, using `/about` will automatically become `/docs/about` when `basePa
export default function HomePage() { export default function HomePage() {
return ( return (
<> <>
<Link href="/about"> <Link href="/about">About Page</Link>
<a>About Page</a>
</Link>
</> </>
) )
} }
......
...@@ -31,19 +31,13 @@ function Home() { ...@@ -31,19 +31,13 @@ function Home() {
return ( return (
<ul> <ul>
<li> <li>
<Link href="/"> <Link href="/">Home</Link>
<a>Home</a>
</Link>
</li> </li>
<li> <li>
<Link href="/about"> <Link href="/about">About Us</Link>
<a>About Us</a>
</Link>
</li> </li>
<li> <li>
<Link href="/blog/hello-world"> <Link href="/blog/hello-world">Blog Post</Link>
<a>Blog Post</a>
</Link>
</li> </li>
</ul> </ul>
) )
...@@ -56,6 +50,7 @@ export default Home ...@@ -56,6 +50,7 @@ export default Home
- `href` - The path or URL to navigate to. This is the only required prop. It can also be an object, see [example here](/docs/api-reference/next/link.md#with-url-object) - `href` - The path or URL to navigate to. This is the only required prop. It can also be an object, see [example here](/docs/api-reference/next/link.md#with-url-object)
- `as` - Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes). - `as` - Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes).
- [`legacyBehavior`](#if-the-child-is-a-tag) - Changes behavior so that child must be `<a>`. Defaults to `false`.
- [`passHref`](#if-the-child-is-a-custom-component-that-wraps-an-a-tag) - Forces `Link` to send the `href` property to its child. Defaults to `false` - [`passHref`](#if-the-child-is-a-custom-component-that-wraps-an-a-tag) - Forces `Link` to send the `href` property to its child. Defaults to `false`
- `prefetch` - Prefetch the page in the background. Defaults to `true`. Any `<Link />` that is in the viewport (initially or through scroll) will be preloaded. Prefetch can be disabled by passing `prefetch={false}`. When `prefetch` is set to `false`, prefetching will still occur on hover. Pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md) will preload `JSON` files with the data for faster page transitions. Prefetching is only enabled in production. - `prefetch` - Prefetch the page in the background. Defaults to `true`. Any `<Link />` that is in the viewport (initially or through scroll) will be preloaded. Prefetch can be disabled by passing `prefetch={false}`. When `prefetch` is set to `false`, prefetching will still occur on hover. Pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md) will preload `JSON` files with the data for faster page transitions. Prefetching is only enabled in production.
- [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false` - [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false`
...@@ -78,7 +73,7 @@ function Posts({ posts }) { ...@@ -78,7 +73,7 @@ function Posts({ posts }) {
{posts.map((post) => ( {posts.map((post) => (
<li key={post.id}> <li key={post.id}>
<Link href={`/blog/${encodeURIComponent(post.slug)}`}> <Link href={`/blog/${encodeURIComponent(post.slug)}`}>
<a>{post.title}</a> {post.title}
</Link> </Link>
</li> </li>
))} ))}
...@@ -89,6 +84,22 @@ function Posts({ posts }) { ...@@ -89,6 +84,22 @@ function Posts({ posts }) {
export default Posts export default Posts
``` ```
## If the child is `<a>` tag
```jsx
import Link from 'next/link'
function Legacy() {
return (
<Link href="/about" legacyBehavior>
<a>About Us</a>
</Link>
)
}
export default Legacy
```
## If the child is a custom component that wraps an `<a>` tag ## If the child is a custom component that wraps an `<a>` tag
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/basic-features/eslint.md#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`. If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/basic-features/eslint.md#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
...@@ -103,9 +114,8 @@ const RedLink = styled.a` ...@@ -103,9 +114,8 @@ const RedLink = styled.a`
` `
function NavLink({ href, name }) { function NavLink({ href, name }) {
// Must add passHref to Link
return ( return (
<Link href={href} passHref> <Link href={href} passHref legacyBehavior>
<RedLink>{name}</RedLink> <RedLink>{name}</RedLink>
</Link> </Link>
) )
...@@ -119,7 +129,7 @@ export default NavLink ...@@ -119,7 +129,7 @@ export default NavLink
## If the child is a functional component ## If the child is a functional component
If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref): If the child of `Link` is a functional component, in addition to using `passHref` and `legacyBehavior`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref):
```jsx ```jsx
import Link from 'next/link' import Link from 'next/link'
...@@ -136,7 +146,7 @@ const MyButton = React.forwardRef(({ onClick, href }, ref) => { ...@@ -136,7 +146,7 @@ const MyButton = React.forwardRef(({ onClick, href }, ref) => {
function Home() { function Home() {
return ( return (
<Link href="/about" passHref> <Link href="/about" passHref legacyBehavior>
<MyButton /> <MyButton />
</Link> </Link>
) )
...@@ -162,7 +172,7 @@ function Home() { ...@@ -162,7 +172,7 @@ function Home() {
query: { name: 'test' }, query: { name: 'test' },
}} }}
> >
<a>About us</a> About us
</Link> </Link>
</li> </li>
<li> <li>
...@@ -172,7 +182,7 @@ function Home() { ...@@ -172,7 +182,7 @@ function Home() {
query: { slug: 'my-post' }, query: { slug: 'my-post' },
}} }}
> >
<a>Blog Post</a> Blog Post
</Link> </Link>
</li> </li>
</ul> </ul>
...@@ -195,7 +205,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi ...@@ -195,7 +205,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi
```jsx ```jsx
<Link href="/about" replace> <Link href="/about" replace>
<a>About us</a> About us
</Link> </Link>
``` ```
...@@ -205,6 +215,6 @@ The default behavior of `Link` is to scroll to the top of the page. When there i ...@@ -205,6 +215,6 @@ The default behavior of `Link` is to scroll to the top of the page. When there i
```jsx ```jsx
<Link href="/#hashid" scroll={false}> <Link href="/#hashid" scroll={false}>
<a>Disables scrolling to the top</a> Disables scrolling to the top
</Link> </Link>
``` ```
...@@ -156,11 +156,7 @@ export default function Page(props) { ...@@ -156,11 +156,7 @@ export default function Page(props) {
<h1>Page: {router.query.slug}</h1> <h1>Page: {router.query.slug}</h1>
<p>Count: {count}</p> <p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increase count</button> <button onClick={() => setCount(count + 1)}>Increase count</button>
<Link href="/one"> <Link href="/one">one</Link> <Link href="/two">two</Link>
<a>one</a>
</Link> <Link href="/two">
<a>two</a>
</Link>
</div> </div>
) )
} }
......
...@@ -78,15 +78,11 @@ export default function Home() { ...@@ -78,15 +78,11 @@ export default function Home() {
import Link from 'next/link' import Link from 'next/link'
export default function Home() { export default function Home() {
return ( return <Link href="/blog">blog</Link>
<Link href="/blog">
<a>blog</a>
</Link>
)
} }
``` ```
Update any import statements, switch `to` to `href`, and add an `<a>` tag as a child of the element. Update any import statements, switch `to` to `href`.
## Data Fetching ## Data Fetching
......
...@@ -34,7 +34,7 @@ import Link from 'next/link' ...@@ -34,7 +34,7 @@ import Link from 'next/link'
export default function App() { export default function App() {
return ( return (
<Link href="/about"> <Link href="/about">
<a>About</a> About
</Link> </Link>
) )
} }
......
...@@ -63,18 +63,14 @@ function Home() { ...@@ -63,18 +63,14 @@ function Home() {
return ( return (
<ul> <ul>
<li> <li>
<Link href="/post/abc"> <Link href="/post/abc">Go to pages/post/[pid].js</Link>
<a>Go to pages/post/[pid].js</a>
</Link>
</li> </li>
<li> <li>
<Link href="/post/abc?foo=bar"> <Link href="/post/abc?foo=bar">Also goes to pages/post/[pid].js</Link>
<a>Also goes to pages/post/[pid].js</a>
</Link>
</li> </li>
<li> <li>
<Link href="/post/abc/a-comment"> <Link href="/post/abc/a-comment">
<a>Go to pages/post/[pid]/[comment].js</a> Go to pages/post/[pid]/[comment].js
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -47,19 +47,13 @@ function Home() { ...@@ -47,19 +47,13 @@ function Home() {
return ( return (
<ul> <ul>
<li> <li>
<Link href="/"> <Link href="/">Home</Link>
<a>Home</a>
</Link>
</li> </li>
<li> <li>
<Link href="/about"> <Link href="/about">About Us</Link>
<a>About Us</a>
</Link>
</li> </li>
<li> <li>
<Link href="/blog/hello-world"> <Link href="/blog/hello-world">Blog Post</Link>
<a>Blog Post</a>
</Link>
</li> </li>
</ul> </ul>
) )
...@@ -89,7 +83,7 @@ function Posts({ posts }) { ...@@ -89,7 +83,7 @@ function Posts({ posts }) {
{posts.map((post) => ( {posts.map((post) => (
<li key={post.id}> <li key={post.id}>
<Link href={`/blog/${encodeURIComponent(post.slug)}`}> <Link href={`/blog/${encodeURIComponent(post.slug)}`}>
<a>{post.title}</a> {post.title}
</Link> </Link>
</li> </li>
))} ))}
...@@ -118,7 +112,7 @@ function Posts({ posts }) { ...@@ -118,7 +112,7 @@ function Posts({ posts }) {
query: { slug: post.slug }, query: { slug: post.slug },
}} }}
> >
<a>{post.title}</a> {post.title}
</Link> </Link>
</li> </li>
))} ))}
......
...@@ -66,9 +66,7 @@ import Link from 'next/link' ...@@ -66,9 +66,7 @@ import Link from 'next/link'
export default function Home() { export default function Home() {
return ( return (
<nav> <nav>
<Link href="/about"> <Link href="/about">About</Link>
<a>About</a>
</Link>
</nav> </nav>
) )
} }
...@@ -183,9 +181,7 @@ import Link from 'next/link' ...@@ -183,9 +181,7 @@ import Link from 'next/link'
export default function Home() { export default function Home() {
return ( return (
<nav> <nav>
<Link href="/about"> <Link href="/about">About</Link>
<a>About</a>
</Link>
</nav> </nav>
) )
} }
......
...@@ -11,6 +11,8 @@ The minimum Node.js version has been bumped from 12.22.0 to 14.0.0, since 12.x h ...@@ -11,6 +11,8 @@ The minimum Node.js version has been bumped from 12.22.0 to 14.0.0, since 12.x h
The `next/image` import was renamed to `next/legacy/image`. The `next/future/image` import was renamed to `next/image`. The `next/image` import was renamed to `next/legacy/image`. The `next/future/image` import was renamed to `next/image`.
A [codemod is available](/docs/advanced-features/codemods.md#next-image-to-legacy-image) to safely and automatically rename your imports. A [codemod is available](/docs/advanced-features/codemods.md#next-image-to-legacy-image) to safely and automatically rename your imports.
The `next/link` child can no longer be `<a>`. Add the `legacyBehavior` prop to use the legacy behavior or remove the `<a>` to upgrade. A [codemod is available](/docs/advanced-features/codemods.md#new-link) to automatically upgrade your code.
## Upgrading to 12.2 ## Upgrading to 12.2
If you were using Middleware prior to `12.2`, please see the [upgrade guide](https://nextjs.org/docs/messages/middleware-upgrade-guide) for more information. If you were using Middleware prior to `12.2`, please see the [upgrade guide](https://nextjs.org/docs/messages/middleware-upgrade-guide) for more information.
......
import { loadEnvConfig } from '@next/env' import { loadEnvConfig } from '@next/env'
import { resolve, join } from 'path' import { resolve, join } from 'path'
import loadConfig from '../../server/config' import loadConfig from '../../server/config'
import { NextConfigComplete } from '../../server/config-shared' import type { NextConfigComplete } from '../../server/config-shared'
import { PHASE_TEST } from '../../shared/lib/constants' import { PHASE_TEST } from '../../shared/lib/constants'
import loadJsConfig from '../load-jsconfig' import loadJsConfig from '../load-jsconfig'
import * as Log from '../output/log' import * as Log from '../output/log'
......
...@@ -556,8 +556,7 @@ export const defaultConfig: NextConfig = { ...@@ -556,8 +556,7 @@ export const defaultConfig: NextConfig = {
// TODO: change default in next major release (current v12.1.5) // TODO: change default in next major release (current v12.1.5)
legacyBrowsers: true, legacyBrowsers: true,
browsersListForSwc: false, browsersListForSwc: false,
// TODO: change default in next major release (current v12.1.5) newNextLinkBehavior: true,
newNextLinkBehavior: false,
cpus: Math.max( cpus: Math.max(
1, 1,
(Number(process.env.CIRCLE_NODE_TOTAL) || (Number(process.env.CIRCLE_NODE_TOTAL) ||
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => ( export default () => (
<div> <div>
<Link href="/hmr/error-in-gip"> <Link href="/hmr/error-in-gip" id="error-in-gip-link">
<a id="error-in-gip-link">Bad Page</a> Bad Page
</Link> </Link>
</div> </div>
) )
...@@ -4,7 +4,7 @@ export default function IndexPage() { ...@@ -4,7 +4,7 @@ export default function IndexPage() {
return ( return (
<div> <div>
<Link href="/about" prefetch> <Link href="/about" prefetch>
<a>To About Page</a> To About Page
</Link> </Link>
</div> </div>
) )
......
...@@ -3,9 +3,7 @@ import Link from 'next/link' ...@@ -3,9 +3,7 @@ import Link from 'next/link'
export default function NoPrefetchPage() { export default function NoPrefetchPage() {
return ( return (
<div> <div>
<Link href="/about"> <Link href="/about">No prefetch</Link>
<a>No prefetch</a>
</Link>
</div> </div>
) )
} }
...@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() { ...@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() {
return ( return (
<div> <div>
<Link href="/about" prefetch={false}> <Link href="/about" prefetch={false}>
<a>Prefetch set to false</a> Prefetch set to false
</Link> </Link>
</div> </div>
) )
......
...@@ -2,8 +2,6 @@ import Link from 'next/link' ...@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => ( export default () => (
<div> <div>
<Link href="/dynamic/no-chunk"> <Link href="/dynamic/no-chunk">No Chunk</Link>
<a>No Chunk</a>
</Link>
</div> </div>
) )
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => ( export default () => (
<div> <div>
<Link href="/hmr/error-in-gip"> <Link href="/hmr/error-in-gip" id="error-in-gip-link">
<a id="error-in-gip-link">Bad Page</a> Bad Page
</Link> </Link>
</div> </div>
) )
...@@ -4,7 +4,7 @@ export default function IndexPage() { ...@@ -4,7 +4,7 @@ export default function IndexPage() {
return ( return (
<div> <div>
<Link href="/about" prefetch> <Link href="/about" prefetch>
<a>To About Page</a> To About Page
</Link> </Link>
</div> </div>
) )
......
...@@ -3,9 +3,7 @@ import Link from 'next/link' ...@@ -3,9 +3,7 @@ import Link from 'next/link'
export default function NoPrefetchPage() { export default function NoPrefetchPage() {
return ( return (
<div> <div>
<Link href="/about"> <Link href="/about">No prefetch</Link>
<a>No prefetch</a>
</Link>
</div> </div>
) )
} }
...@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() { ...@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() {
return ( return (
<div> <div>
<Link href="/about" prefetch={false}> <Link href="/about" prefetch={false}>
<a>Prefetch set to false</a> Prefetch set to false
</Link> </Link>
</div> </div>
) )
......
...@@ -2,8 +2,6 @@ import Link from 'next/link' ...@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => ( export default () => (
<div> <div>
<Link href="/dynamic/no-chunk"> <Link href="/dynamic/no-chunk">No Chunk</Link>
<a>No Chunk</a>
</Link>
</div> </div>
) )
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function HomePage() { export default function HomePage() {
return ( return (
<> <>
<Link href="/dashboard"> <Link href="/dashboard" id="to-dashboard">
<a id="to-dashboard">To Dashboard</a> To Dashboard
</Link> </Link>
</> </>
) )
......
...@@ -10,34 +10,34 @@ export default function Page({ params }) { ...@@ -10,34 +10,34 @@ export default function Page({ params }) {
<p id="page">/blog/[author]</p> <p id="page">/blog/[author]</p>
<p id="params">{JSON.stringify(params)}</p> <p id="params">{JSON.stringify(params)}</p>
<p id="date">{Date.now()}</p> <p id="date">{Date.now()}</p>
<Link href="/blog/tim"> <Link href="/blog/tim" id="author-1">
<a id="author-1">/blog/tim</a> /blog/tim
</Link> </Link>
<br /> <br />
<Link href="/blog/seb"> <Link href="/blog/seb" id="author-2">
<a id="author-2">/blog/seb</a> /blog/seb
</Link> </Link>
<br /> <br />
<Link href="/blog/styfle"> <Link href="/blog/styfle" id="author-3">
<a id="author-3">/blog/styfle</a> /blog/styfle
</Link> </Link>
<br /> <br />
<Link href="/blog/tim/first-post"> <Link href="/blog/tim/first-post" id="author-1-post-1">
<a id="author-1-post-1">/blog/tim/first-post</a> /blog/tim/first-post
</Link> </Link>
<br /> <br />
<Link href="/blog/seb/second-post"> <Link href="/blog/seb/second-post" id="author-2-post-1">
<a id="author-2-post-1">/blog/seb/second-post</a> /blog/seb/second-post
</Link> </Link>
<br /> <br />
<Link href="/blog/styfle/first-post"> <Link href="/blog/styfle/first-post" id="author-3-post-1">
<a id="author-3-post-1">/blog/styfle/first-post</a> /blog/styfle/first-post
</Link> </Link>
<br /> <br />
<Link href="/dynamic-no-gen-params/first"> <Link href="/dynamic-no-gen-params/first" id="dynamic-no-params">
<a id="dynamic-no-params">/dynamic-no-gen-params/first</a> /dynamic-no-gen-params/first
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -6,13 +6,13 @@ export default function Page({ params }) { ...@@ -6,13 +6,13 @@ export default function Page({ params }) {
<p id="page">/dynamic-no-gen-params</p> <p id="page">/dynamic-no-gen-params</p>
<p id="params">{JSON.stringify(params)}</p> <p id="params">{JSON.stringify(params)}</p>
<Link href="/dynamic-no-gen-params/second"> <Link href="/dynamic-no-gen-params/second" id="dynamic-no-params-again">
<a id="dynamic-no-params-again">/dynamic-no-gen-params/second</a> /dynamic-no-gen-params/second
</Link> </Link>
<br /> <br />
<Link href="/blog/styfle"> <Link href="/blog/styfle" id="to-blog">
<a id="to-blog">/blog/styfle</a> /blog/styfle
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -4,13 +4,16 @@ export default function Page() { ...@@ -4,13 +4,16 @@ export default function Page() {
return ( return (
<> <>
<div> <div>
<Link href="/catch-all/this/is/a/test"> <Link href="/catch-all/this/is/a/test" id="to-catch-all">
<a id="to-catch-all">To catch-all</a> To catch-all
</Link> </Link>
</div> </div>
<div> <div>
<Link href="/catch-all-optional/this/is/a/test"> <Link
<a id="to-catch-all-optional">To optional catch-all</a> href="/catch-all-optional/this/is/a/test"
id="to-catch-all-optional"
>
To optional catch-all
</Link> </Link>
</div> </div>
</> </>
......
...@@ -4,13 +4,13 @@ export default function Page() { ...@@ -4,13 +4,13 @@ export default function Page() {
return ( return (
<div> <div>
<div> <div>
<Link href="/internal/test/rewrite"> <Link href="/internal/test/rewrite" id="navigate-rewrite">
<a id="navigate-rewrite">Navigate Rewrite</a> Navigate Rewrite
</Link> </Link>
</div> </div>
<div> <div>
<Link href="/internal/test/redirect"> <Link href="/internal/test/redirect" id="navigate-redirect">
<a id="navigate-redirect">Navigate Redirect</a> Navigate Redirect
</Link> </Link>
</div> </div>
</div> </div>
......
...@@ -6,8 +6,8 @@ export default function Page({ params }) { ...@@ -6,8 +6,8 @@ export default function Page({ params }) {
return ( return (
<> <>
<h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '} <h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '}
<Link href={`/link-hard-push/${other}`}> <Link href={`/link-hard-push/${other}`} id="link">
<a id="link">To {other}</a> To{other}
</Link> </Link>
</> </>
) )
......
...@@ -6,8 +6,8 @@ export default function Page({ params }) { ...@@ -6,8 +6,8 @@ export default function Page({ params }) {
return ( return (
<> <>
<h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '} <h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '}
<Link href={`/link-hard-replace/${other}`} replace> <Link href={`/link-hard-replace/${other}`} replace id="link">
<a id="link">To {other}</a> To{other}
</Link> </Link>
</> </>
) )
......
...@@ -5,11 +5,11 @@ export default function Page() { ...@@ -5,11 +5,11 @@ export default function Page() {
return ( return (
<> <>
<h1 id="render-id">{nanoid()}</h1> <h1 id="render-id">{nanoid()}</h1>
<Link href="/link-hard-replace" replace> <Link href="/link-hard-replace" replace id="self-link">
<a id="self-link">Self Link</a> Self Link
</Link> </Link>
<Link href="/link-hard-replace/subpage" replace> <Link href="/link-hard-replace/subpage" replace id="subpage-link">
<a id="subpage-link">Subpage</a> Subpage
</Link> </Link>
</> </>
) )
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<Link href="/link-hard-replace" replace> <Link href="/link-hard-replace" replace id="back-link">
<a id="back-link">Self Link</a> Self Link
</Link> </Link>
) )
} }
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<Link href="/with-id"> <Link href="/with-id" id="link">
<a id="link">With ID</a> With ID
</Link> </Link>
) )
} }
...@@ -5,11 +5,11 @@ export default function Page() { ...@@ -5,11 +5,11 @@ export default function Page() {
return ( return (
<> <>
<h1 id="render-id">{nanoid()}</h1> <h1 id="render-id">{nanoid()}</h1>
<Link href="/link-soft-replace" replace> <Link href="/link-soft-replace" replace id="self-link">
<a id="self-link">Self Link</a> Self Link
</Link> </Link>
<Link href="/link-soft-replace/subpage" replace> <Link href="/link-soft-replace/subpage" replace id="subpage-link">
<a id="subpage-link">Subpage</a> Subpage
</Link> </Link>
</> </>
) )
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<Link href="/link-soft-replace" replace> <Link href="/link-soft-replace" replace id="back-link">
<a id="back-link">Self Link</a> Self Link
</Link> </Link>
) )
} }
...@@ -6,8 +6,9 @@ export default function Page() { ...@@ -6,8 +6,9 @@ export default function Page() {
<Link <Link
href="/dashboard/deployments/info/[id]" href="/dashboard/deployments/info/[id]"
as="/dashboard/deployments/info/123" as="/dashboard/deployments/info/123"
id="link-to-info-123"
> >
<a id="link-to-info-123">To info 123</a> To info 123
</Link> </Link>
</> </>
) )
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export const TabNavItem = ({ children, href }) => { export const TabNavItem = ({ children, href }) => {
return ( return (
<Link href={href}> <Link href={href} style={{ margin: '10px', display: 'block' }}>
<a style={{ margin: '10px', display: 'block' }}>{children}</a> {children}
</Link> </Link>
) )
} }
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page(props) { export default function Page(props) {
return ( return (
<Link href="/app-linking"> <Link href="/app-linking" id="app-link">
<a id="app-link">To Pages Page</a> To Pages Page
</Link> </Link>
) )
} }
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<> <>
<Link href="/redirect/a"> <Link href="/redirect/a" id="redirect-a">
<a id="redirect-a">To Dashboard through /redirect/a</a> To Dashboard through /redirect/a
</Link> </Link>
</> </>
) )
......
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<> <>
<Link href="/redirect-middleware-to-dashboard"> <Link href="/redirect-middleware-to-dashboard" id="redirect-middleware">
<a id="redirect-middleware">To Dashboard through /redirect/a</a> To Dashboard through /redirect/a
</Link> </Link>
</> </>
) )
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<Link href="/rewritten-to-dashboard"> <Link href="/rewritten-to-dashboard" id="link">
<a id="link">To Dashboard Rewritten</a> To Dashboard Rewritten
</Link> </Link>
) )
} }
...@@ -4,8 +4,8 @@ export default function Page() { ...@@ -4,8 +4,8 @@ export default function Page() {
return ( return (
<> <>
<h1 id="first-page">hello from same-layout/first</h1> <h1 id="first-page">hello from same-layout/first</h1>
<Link href="/same-layout/second"> <Link href="/same-layout/second" id="link">
<a id="link">To Second</a> To Second
</Link> </Link>
</> </>
) )
......
...@@ -4,8 +4,8 @@ export default function Page() { ...@@ -4,8 +4,8 @@ export default function Page() {
return ( return (
<> <>
<h1 id="second-page">hello from same-layout/second</h1> <h1 id="second-page">hello from same-layout/second</h1>
<Link href="/same-layout/first"> <Link href="/same-layout/first" id="link">
<a id="link">To First</a> To First
</Link> </Link>
</> </>
) )
......
...@@ -3,8 +3,8 @@ export default function Page() { ...@@ -3,8 +3,8 @@ export default function Page() {
return ( return (
<> <>
<p id="other-page">Other Page</p> <p id="other-page">Other Page</p>
<Link href="/template/clientcomponent"> <Link href="/template/clientcomponent" id="link">
<a id="link">To Page</a> To Page
</Link> </Link>
</> </>
) )
......
...@@ -4,8 +4,8 @@ export default function Page() { ...@@ -4,8 +4,8 @@ export default function Page() {
return ( return (
<> <>
<p id="page">Page</p> <p id="page">Page</p>
<Link href="/template/clientcomponent/other"> <Link href="/template/clientcomponent/other" id="link">
<a id="link">To Other</a> To Other
</Link> </Link>
</> </>
) )
......
...@@ -3,8 +3,8 @@ export default function Page() { ...@@ -3,8 +3,8 @@ export default function Page() {
return ( return (
<> <>
<p id="other-page">Other Page</p> <p id="other-page">Other Page</p>
<Link href="/template/servercomponent"> <Link href="/template/servercomponent" id="link">
<a id="link">To Page</a> To Page
</Link> </Link>
</> </>
) )
......
...@@ -4,8 +4,8 @@ export default function Page() { ...@@ -4,8 +4,8 @@ export default function Page() {
return ( return (
<> <>
<p id="page">Page</p> <p id="page">Page</p>
<Link href="/template/servercomponent/other"> <Link href="/template/servercomponent/other" id="link">
<a id="link">To Other</a> To Other
</Link> </Link>
</> </>
) )
......
...@@ -5,8 +5,8 @@ export default function Page() { ...@@ -5,8 +5,8 @@ export default function Page() {
return ( return (
<> <>
<h1 id="render-id">{nanoid()}</h1> <h1 id="render-id">{nanoid()}</h1>
<Link href="/navigation"> <Link href="/navigation" id="link">
<a id="link">To Navigation</a> To Navigation
</Link> </Link>
</> </>
) )
......
...@@ -2,8 +2,8 @@ import Link from 'next/link' ...@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page(props) { export default function Page(props) {
return ( return (
<Link href="/pages-linking"> <Link href="/pages-linking" id="pages-link">
<a id="pages-link">To App Page</a> To App Page
</Link> </Link>
) )
} }
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page(props) { export default function Page(props) {
return ( return (
<> <>
<Link href="/exists-but-not-routed"> <Link href="/exists-but-not-routed" id="link-to-rewritten-path">
<a id="link-to-rewritten-path">Exists but not routed</a> Exists but not routed
</Link> </Link>
</> </>
) )
......
...@@ -3,8 +3,8 @@ export default function HomePage() { ...@@ -3,8 +3,8 @@ export default function HomePage() {
return ( return (
<> <>
<p> <p>
<Link href="/a/"> <Link href="/a/" id="to-a-trailing-slash">
<a id="to-a-trailing-slash">To a with trailing slash</a> To a with trailing slash
</Link> </Link>
</p> </p>
</> </>
......
...@@ -8,8 +8,8 @@ export default function LinkPage({ searchParams }) { ...@@ -8,8 +8,8 @@ export default function LinkPage({ searchParams }) {
<> <>
<h3 id="query">query:{id}</h3> <h3 id="query">query:{id}</h3>
<div> <div>
<Link href={`/next-api/link?id=${id + 1}`}> <Link href={`/next-api/link?id=${id + 1}`} id="next_id">
<a id="next_id">next id</a> next id
</Link> </Link>
</div> </div>
<Nav /> <Nav />
......
...@@ -4,18 +4,18 @@ export default function Nav() { ...@@ -4,18 +4,18 @@ export default function Nav() {
return ( return (
<> <>
<div> <div>
<Link href={'/next-api/link'}> <Link href={'/next-api/link'} id="goto-next-link">
<a id="goto-next-link">next link</a> next link
</Link> </Link>
</div> </div>
<div> <div>
<Link href={'/streaming-rsc'}> <Link href={'/streaming-rsc'} id="goto-streaming-rsc">
<a id="goto-streaming-rsc">streaming rsc</a> streaming rsc
</Link> </Link>
</div> </div>
<div> <div>
<Link href={'/root'}> <Link href={'/root'} id="goto-home">
<a id="goto-home">home</a> home
</Link> </Link>
</div> </div>
</> </>
......
...@@ -3,8 +3,8 @@ export default function HomePage() { ...@@ -3,8 +3,8 @@ export default function HomePage() {
return ( return (
<> <>
<p> <p>
<Link href="/a/"> <Link href="/a/" id="to-a-trailing-slash">
<a id="to-a-trailing-slash">To a with trailing slash</a> To a with trailing slash
</Link> </Link>
</p> </p>
</> </>
......
...@@ -13,11 +13,12 @@ export default function Page({ port }) { ...@@ -13,11 +13,12 @@ export default function Page({ port }) {
const router = useRouter() const router = useRouter()
return ( return (
<> <>
<Link href={`http://localhost:${port}${router.basePath}/something-else`}> <Link
<a id="absolute-link"> href={`http://localhost:${port}${router.basePath}/something-else`}
id="absolute-link"
>
http://localhost:{port} http://localhost:{port}
{router.basePath}/something-else {router.basePath}/something-else
</a>
</Link> </Link>
</> </>
) )
......
...@@ -11,8 +11,11 @@ export async function getServerSideProps({ query: { port } }) { ...@@ -11,8 +11,11 @@ export async function getServerSideProps({ query: { port } }) {
export default function Page({ port }) { export default function Page({ port }) {
return ( return (
<> <>
<Link href={`http://localhost:${port}/rewrite-no-basepath`}> <Link
<a id="absolute-link">http://localhost:{port}/rewrite-no-basepath</a> href={`http://localhost:${port}/rewrite-no-basepath`}
id="absolute-link"
>
http://localhost:{port}/rewrite-no-basepath
</Link> </Link>
</> </>
) )
......
...@@ -4,12 +4,12 @@ import Link from 'next/link' ...@@ -4,12 +4,12 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<> <>
<Link href="https://vercel.com/"> <Link href="https://vercel.com/" id="absolute-link">
<a id="absolute-link">https://vercel.com/</a> https://vercel.com/
</Link> </Link>
<br /> <br />
<Link href="mailto:idk@idk.com"> <Link href="mailto:idk@idk.com" id="mailto-link">
<a id="mailto-link">mailto:idk@idk.com</a> mailto:idk@idk.com
</Link> </Link>
</> </>
) )
......
...@@ -3,49 +3,39 @@ import { useRouter } from 'next/router' ...@@ -3,49 +3,39 @@ import { useRouter } from 'next/router'
const Page = () => ( const Page = () => (
<> <>
<Link href="/other-page"> <Link href="/other-page" id="other-page-link">
<a id="other-page-link">
<h1>Hello World</h1> <h1>Hello World</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/gsp"> <Link href="/gsp" id="gsp-link">
<a id="gsp-link">
<h1>getStaticProps</h1> <h1>getStaticProps</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/gssp"> <Link href="/gssp" id="gssp-link">
<a id="gssp-link">
<h1>getServerSideProps</h1> <h1>getServerSideProps</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/[slug]" as="/first"> <Link href="/[slug]" as="/first" id="dynamic-link">
<a id="dynamic-link">
<h1>dynamic page</h1> <h1>dynamic page</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/catchall/[...parts]" as="/catchall/hello/world"> <Link
<a id="catchall-link"> href="/catchall/[...parts]"
as="/catchall/hello/world"
id="catchall-link"
>
<h1>catchall page</h1> <h1>catchall page</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/"> <Link href="/" id="index-gsp">
<a id="index-gsp">
<h1>index getStaticProps</h1> <h1>index getStaticProps</h1>
</a>
</Link> </Link>
<br /> <br />
<Link href="/index"> <Link href="/index" id="nested-index-gsp">
<a id="nested-index-gsp">
<h1>nested index getStaticProps</h1> <h1>nested index getStaticProps</h1>
</a>
</Link> </Link>
<Link href="#hashlink"> <Link href="#hashlink" id="hashlink">
<a id="hashlink">Hash Link</a> Hash Link
</Link> </Link>
<br /> <br />
<div id="base-path">{useRouter().basePath}</div> <div id="base-path">{useRouter().basePath}</div>
...@@ -60,23 +50,17 @@ const Page = () => ( ...@@ -60,23 +50,17 @@ const Page = () => (
</div> </div>
<br /> <br />
<div id="as-path">{useRouter().asPath}</div> <div id="as-path">{useRouter().asPath}</div>
<Link href="/slow-route"> <Link href="/slow-route" id="slow-route">
<a id="slow-route">
<h1>Slow route</h1> <h1>Slow route</h1>
</a>
</Link> </Link>
<Link href="/error-route"> <Link href="/error-route" id="error-route">
<a id="error-route">
<h1>Error route</h1> <h1>Error route</h1>
</a>
</Link> </Link>
<Link href="/hello#some-hash"> <Link href="/hello#some-hash" id="hash-change">
<a id="hash-change">
<h1>Hash change</h1> <h1>Hash change</h1>
</a>
</Link> </Link>
<Link href="/something-else" as="/hello"> <Link href="/something-else" as="/hello" id="something-else-link">
<a id="something-else-link">to something else</a> to something else
</Link> </Link>
</> </>
) )
......
...@@ -20,8 +20,8 @@ export default function Index({ hello, nested }) { ...@@ -20,8 +20,8 @@ export default function Index({ hello, nested }) {
<p id="query">{JSON.stringify(query)}</p> <p id="query">{JSON.stringify(query)}</p>
<p id="pathname">{pathname}</p> <p id="pathname">{pathname}</p>
<p id="as-path">{asPath}</p> <p id="as-path">{asPath}</p>
<Link href="/hello"> <Link href="/hello" id="hello-link">
<a id="hello-link">to /hello</a> to /hello
</Link> </Link>
</> </>
) )
......
...@@ -3,10 +3,8 @@ import { useRouter } from 'next/router' ...@@ -3,10 +3,8 @@ import { useRouter } from 'next/router'
const Page = () => ( const Page = () => (
<> <>
<Link href={`${useRouter().basePath}/other-page`}> <Link href={`${useRouter().basePath}/other-page`} id="other-page-link">
<a id="other-page-link">
<h1>Hello World</h1> <h1>Hello World</h1>
</a>
</Link> </Link>
</> </>
) )
......
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<> <>
<Link href="/"> <Link href="/" id="link-back">
<a id="link-back">back</a> back
</Link> </Link>
</> </>
) )
......
...@@ -23,8 +23,8 @@ describe('Dynamic Route Interpolation', () => { ...@@ -23,8 +23,8 @@ describe('Dynamic Route Interpolation', () => {
return ( return (
<> <>
<p id="slug">{props.slug}</p> <p id="slug">{props.slug}</p>
<Link href={router.asPath}> <Link id="now" href={router.asPath}>
<a id="now">{props.now}</a> {props.now}
</Link> </Link>
</> </>
) )
......
...@@ -19,12 +19,12 @@ export default ({ world, time }) => ( ...@@ -19,12 +19,12 @@ export default ({ world, time }) => (
<> <>
<p>hello {world}</p> <p>hello {world}</p>
<span id="anotherTime">time: {time}</span> <span id="anotherTime">time: {time}</span>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/something"> <Link href="/something" id="something">
<a id="something">to something</a> to something
</Link> </Link>
</> </>
) )
...@@ -17,8 +17,8 @@ export default ({ post, comment, time }) => { ...@@ -17,8 +17,8 @@ export default ({ post, comment, time }) => {
<p>Post: {post}</p> <p>Post: {post}</p>
<p>Comment: {comment}</p> <p>Comment: {comment}</p>
<span>time: {time}</span> <span>time: {time}</span>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
</> </>
) )
......
...@@ -36,8 +36,8 @@ export default ({ post, time, params, appProps, resolvedUrl }) => { ...@@ -36,8 +36,8 @@ export default ({ post, time, params, appProps, resolvedUrl }) => {
<div id="app-url">{appProps.url}</div> <div id="app-url">{appProps.url}</div>
<div id="resolved-url">{resolvedUrl}</div> <div id="resolved-url">{resolvedUrl}</div>
<div id="as-path">{router.asPath}</div> <div id="as-path">{router.asPath}</div>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
</> </>
) )
......
...@@ -15,8 +15,8 @@ export default ({ slugs, time }) => { ...@@ -15,8 +15,8 @@ export default ({ slugs, time }) => {
<> <>
<p>Posts: {JSON.stringify(slugs)}</p> <p>Posts: {JSON.stringify(slugs)}</p>
<span>time: {time}</span> <span>time: {time}</span>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
</> </>
) )
......
...@@ -21,12 +21,12 @@ export default ({ world, time, params, random }) => { ...@@ -21,12 +21,12 @@ export default ({ world, time, params, random }) => {
<div id="random">{random}</div> <div id="random">{random}</div>
<div id="params">{JSON.stringify(params)}</div> <div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div> <div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/another"> <Link href="/another" id="another">
<a id="another">to another</a> to another
</Link> </Link>
</> </>
) )
......
...@@ -13,12 +13,12 @@ export default ({ world, time }) => ( ...@@ -13,12 +13,12 @@ export default ({ world, time }) => (
<> <>
<p>hello {world}</p> <p>hello {world}</p>
<span>time: {time}</span> <span>time: {time}</span>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/something"> <Link href="/something" id="something">
<a id="something">to something</a> to something
</Link> </Link>
</> </>
) )
...@@ -56,38 +56,42 @@ const Page = ({ world, time, url }) => { ...@@ -56,38 +56,42 @@ const Page = ({ world, time, url }) => {
<> <>
<p>hello {world}</p> <p>hello {world}</p>
<span>time: {time}</span> <span>time: {time}</span>
<Link href="/non-json"> <Link href="/non-json" id="non-json">
<a id="non-json">to non-json</a> to non-json
</Link> </Link>
<br /> <br />
<Link href="/another"> <Link href="/another" id="another">
<a id="another">to another</a> to another
</Link> </Link>
<br /> <br />
<Link href="/something"> <Link href="/something" id="something">
<a id="something">to something</a> to something
</Link> </Link>
<br /> <br />
<Link href="/normal"> <Link href="/normal" id="normal">
<a id="normal">to normal</a> to normal
</Link> </Link>
<br /> <br />
<Link href="/slow"> <Link href="/slow" id="slow">
<a id="slow">to slow</a> to slow
</Link> </Link>
<br /> <br />
<Link href="/blog/[post]" as="/blog/post-1"> <Link href="/blog/[post]" as="/blog/post-1" id="post-1">
<a id="post-1">to dynamic</a> to dynamic
</Link> </Link>
<Link href="/blog/[post]" as="/blog/post-100"> <Link href="/blog/[post]" as="/blog/post-100" id="broken-post">
<a id="broken-post">to broken</a> to broken
</Link> </Link>
<br /> <br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1"> <Link
<a id="comment-1">to another dynamic</a> href="/blog/[post]/[comment]"
as="/blog/post-1/comment-1"
id="comment-1"
>
to another dynamic
</Link> </Link>
<Link href="/something?another=thing"> <Link href="/something?another=thing" id="something-query">
<a id="something-query">to something?another=thing</a> to something?another=thing
</Link> </Link>
</> </>
) )
......
...@@ -21,12 +21,12 @@ export default ({ world, time, params, random, query }) => { ...@@ -21,12 +21,12 @@ export default ({ world, time, params, random, query }) => {
<div id="params">{JSON.stringify(params)}</div> <div id="params">{JSON.stringify(params)}</div>
<div id="initial-query">{JSON.stringify(query)}</div> <div id="initial-query">{JSON.stringify(query)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div> <div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/another"> <Link href="/another" id="another">
<a id="another">to another</a> to another
</Link> </Link>
</> </>
) )
......
...@@ -11,8 +11,8 @@ export default function Page(props) { ...@@ -11,8 +11,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p> <p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p> <p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p> <p id="router-as-path">{router.asPath}</p>
<Link href="/"> <Link href="/" id="to-index">
<a id="to-index">to /</a> to /
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -11,8 +11,8 @@ export default function Page(props) { ...@@ -11,8 +11,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p> <p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p> <p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p> <p id="router-as-path">{router.asPath}</p>
<Link href="/"> <Link href="/" id="to-index">
<a id="to-index">to /</a> to /
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -15,12 +15,12 @@ export default ({ count }) => ( ...@@ -15,12 +15,12 @@ export default ({ count }) => (
<> <>
<p>a slow page</p> <p>a slow page</p>
<p id="hit">hit: {count}</p> <p id="hit">hit: {count}</p>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/something"> <Link href="/something" id="something">
<a id="something">to something</a> to something
</Link> </Link>
</> </>
) )
...@@ -38,12 +38,12 @@ export default ({ ...@@ -38,12 +38,12 @@ export default ({
<div id="app-url">{appProps.url}</div> <div id="app-url">{appProps.url}</div>
<div id="resolved-url">{resolvedUrl}</div> <div id="resolved-url">{resolvedUrl}</div>
<div id="as-path">{router.asPath}</div> <div id="as-path">{router.asPath}</div>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
<br /> <br />
<Link href="/another"> <Link href="/another" id="another">
<a id="another">to another</a> to another
</Link> </Link>
</> </>
) )
......
...@@ -15,8 +15,8 @@ export default ({ user, time }) => { ...@@ -15,8 +15,8 @@ export default ({ user, time }) => {
<> <>
<p>User: {user}</p> <p>User: {user}</p>
<span>time: {time}</span> <span>time: {time}</span>
<Link href="/"> <Link href="/" id="home">
<a id="home">to home</a> to home
</Link> </Link>
</> </>
) )
......
...@@ -3,38 +3,40 @@ import Link from 'next/link' ...@@ -3,38 +3,40 @@ import Link from 'next/link'
export default function Component() { export default function Component() {
return ( return (
<> <>
<Link href="/gssp-redirect/en"> <Link href="/gssp-redirect/en" id="to-gssp-redirect-en">
<a id="to-gssp-redirect-en">to /gssp-redirect/en"</a> to /gssp-redirect/en"
</Link> </Link>
<Link href="/gssp-redirect/sv"> <Link href="/gssp-redirect/sv" id="to-gssp-redirect-sv">
<a id="to-gssp-redirect-sv">to /gssp-redirect/sv"</a> to /gssp-redirect/sv"
</Link> </Link>
<Link href="/gssp-redirect/from-ctx"> <Link href="/gssp-redirect/from-ctx" id="to-gssp-redirect-from-ctx">
<a id="to-gssp-redirect-from-ctx">to /gssp-redirect/from-ctx</a> to /gssp-redirect/from-ctx
</Link> </Link>
<Link href="/gsp-blocking-redirect/en"> <Link href="/gsp-blocking-redirect/en" id="to-gsp-blocking-redirect-en">
<a id="to-gsp-blocking-redirect-en">to /gsp-blocking-redirect/en"</a> to /gsp-blocking-redirect/en"
</Link> </Link>
<Link href="/gsp-blocking-redirect/sv"> <Link href="/gsp-blocking-redirect/sv" id="to-gsp-blocking-redirect-sv">
<a id="to-gsp-blocking-redirect-sv">to /gsp-blocking-redirect/sv"</a> to /gsp-blocking-redirect/sv"
</Link> </Link>
<Link href="/gsp-blocking-redirect/from-ctx"> <Link
<a id="to-gsp-blocking-redirect-from-ctx"> href="/gsp-blocking-redirect/from-ctx"
id="to-gsp-blocking-redirect-from-ctx"
>
to /gsp-blocking-redirect/from-ctx to /gsp-blocking-redirect/from-ctx
</a>
</Link> </Link>
<Link href="/gsp-fallback-redirect/en"> <Link href="/gsp-fallback-redirect/en" id="to-gsp-fallback-redirect-en">
<a id="to-gsp-fallback-redirect-en">to /gsp-fallback-redirect/en"</a> to /gsp-fallback-redirect/en"
</Link> </Link>
<Link href="/gsp-fallback-redirect/sv"> <Link href="/gsp-fallback-redirect/sv" id="to-gsp-fallback-redirect-sv">
<a id="to-gsp-fallback-redirect-sv">to /gsp-fallback-redirect/sv"</a> to /gsp-fallback-redirect/sv"
</Link> </Link>
<Link href="/gsp-fallback-redirect/from-ctx"> <Link
<a id="to-gsp-fallback-redirect-from-ctx"> href="/gsp-fallback-redirect/from-ctx"
id="to-gsp-fallback-redirect-from-ctx"
>
to /gsp-fallback-redirect/from-ctx to /gsp-fallback-redirect/from-ctx
</a>
</Link> </Link>
</> </>
) )
......
...@@ -3,11 +3,11 @@ import Link from 'next/link' ...@@ -3,11 +3,11 @@ import Link from 'next/link'
export default function Page() { export default function Page() {
return ( return (
<div> <div>
<Link href="/some/route/for?json=true"> <Link href="/some/route/for?json=true" id="rewrite">
<a id="rewrite">to /some/route/for?json=true</a> to /some/route/for?json=true
</Link> </Link>
<Link href="/api/json"> <Link href="/api/json" id="direct">
<a id="direct">to /api/json</a> to /api/json
</Link> </Link>
</div> </div>
) )
......
...@@ -27,13 +27,13 @@ export default function Page(props) { ...@@ -27,13 +27,13 @@ export default function Page(props) {
)} )}
</p> </p>
<Link href="/"> <Link href="/" id="to-index">
<a id="to-index">to /index</a> to /index
</Link> </Link>
<br /> <br />
<Link href="/dynamic/first"> <Link href="/dynamic/first" id="to-dynamic">
<a id="to-dynamic">to /dynamic/first</a> to /dynamic/first
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -27,13 +27,13 @@ export default function Page(props) { ...@@ -27,13 +27,13 @@ export default function Page(props) {
)} )}
</p> </p>
<Link href="/"> <Link href="/" id="to-index">
<a id="to-index">to /index</a> to /index
</Link> </Link>
<br /> <br />
<Link href="/dynamic/second"> <Link href="/dynamic/second" id="to-dynamic">
<a id="to-dynamic">to /dynamic/second</a> to /dynamic/second
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -27,13 +27,13 @@ export default function Page(props) { ...@@ -27,13 +27,13 @@ export default function Page(props) {
)} )}
</p> </p>
<Link href="/another"> <Link href="/another" id="to-another">
<a id="to-another">to /another</a> to /another
</Link> </Link>
<br /> <br />
<Link href="/dynamic/first"> <Link href="/dynamic/first" id="to-dynamic">
<a id="to-dynamic">to /dynamic/first</a> to /dynamic/first
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -6,30 +6,29 @@ export default function Main({ message }) { ...@@ -6,30 +6,29 @@ export default function Main({ message }) {
<h1 className="title">Hello {message}</h1> <h1 className="title">Hello {message}</h1>
<ul> <ul>
<li> <li>
<Link href="/stream-response"> <Link href="/stream-response">Stream a response</Link>
<a>Stream a response</a>
</Link>
</li> </li>
<li> <li>
<Link href="/rewrite-me-to-about?message=refreshed"> <Link
<a id="link-with-rewritten-url" className={message}> href="/rewrite-me-to-about?message=refreshed"
id="link-with-rewritten-url"
className={message}
>
Rewrite me to about Rewrite me to about
</a>
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/rewrite-me-to-vercel"> <Link href="/rewrite-me-to-vercel">Rewrite me to Vercel</Link>
<a>Rewrite me to Vercel</a>
</Link>
</li> </li>
<li> <li>
<Link href="/redirect-me-to-about"> <Link href="/redirect-me-to-about">redirect me to about</Link>
<a>redirect me to about</a>
</Link>
</li> </li>
<li> <li>
<Link href="/dynamic-routes/hello-world"> <Link
<a id="go-to-hello-world-anchor">Hello World</a> href="/dynamic-routes/hello-world"
id="go-to-hello-world-anchor"
>
Hello World
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default (props) => ( export default (props) => (
<ul> <ul>
<li> <li>
<Link href="/hello"> <Link href="/hello" id="hello">
<a id="hello">/hello</a> /hello
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -3,23 +3,23 @@ import Link from 'next/link' ...@@ -3,23 +3,23 @@ import Link from 'next/link'
export default (props) => ( export default (props) => (
<ul> <ul>
<li> <li>
<Link href="/hello"> <Link href="/hello" id="hello">
<a id="hello">/hello</a> /hello
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/en/hello"> <Link href="/en/hello" id="en_hello">
<a id="en_hello">/en/hello</a> /en/hello
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/nl-NL/hello"> <Link href="/nl-NL/hello" id="nl-NL_hello">
<a id="nl-NL_hello">/nl-NL/hello</a> /nl-NL/hello
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/nl-NL/about"> <Link href="/nl-NL/about" id="nl-NL_about">
<a id="nl-NL_about">/nl-NL/about</a> /nl-NL/about
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -3,13 +3,13 @@ import Link from 'next/link' ...@@ -3,13 +3,13 @@ import Link from 'next/link'
export default (props) => ( export default (props) => (
<ul> <ul>
<li> <li>
<Link href="/has-match-2?my-query=hellooo"> <Link href="/has-match-2?my-query=hellooo" id="has-match-2">
<a id="has-match-2">has-match-2</a> has-match-2
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/has-match-3"> <Link href="/has-match-3" id="has-match-3">
<a id="has-match-3">has-match-3</a> has-match-3
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Errors() { export default function Errors() {
return ( return (
<div> <div>
<Link href="/error-throw?message=refreshed"> <Link href="/error-throw?message=refreshed" id="throw-on-data">
<a id="throw-on-data">Throw on data</a> Throw on data
</Link> </Link>
</div> </div>
) )
......
...@@ -8,13 +8,13 @@ export default function Shallow({ message }) { ...@@ -8,13 +8,13 @@ export default function Shallow({ message }) {
<ul> <ul>
<li id="message-contents">{message}</li> <li id="message-contents">{message}</li>
<li> <li>
<Link href="/sha?hello=world" shallow> <Link href="/sha?hello=world" shallow id="shallow-link">
<a id="shallow-link">Shallow link to ?hello=world</a> Shallow link to ?hello=world
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/sha?hello=goodbye"> <Link href="/sha?hello=goodbye" id="deep-link">
<a id="deep-link">Deep link to ?hello=goodbye</a> Deep link to ?hello=goodbye
</Link> </Link>
</li> </li>
<li> <li>
......
...@@ -5,8 +5,8 @@ export default function Page(props) { ...@@ -5,8 +5,8 @@ export default function Page(props) {
<div> <div>
<p id="another-middleware">This should also run the middleware</p> <p id="another-middleware">This should also run the middleware</p>
<p id="props">{JSON.stringify(props)}</p> <p id="props">{JSON.stringify(props)}</p>
<Link href="/"> <Link href="/" id="to-index">
<a id="to-index">to /</a> to /
</Link> </Link>
<br /> <br />
</div> </div>
......
...@@ -5,12 +5,12 @@ export default function Page(props) { ...@@ -5,12 +5,12 @@ export default function Page(props) {
<div> <div>
<p id="blog">This should not run the middleware</p> <p id="blog">This should not run the middleware</p>
<p id="props">{JSON.stringify(props)}</p> <p id="props">{JSON.stringify(props)}</p>
<Link href="/another-middleware"> <Link href="/another-middleware" id="to-another-middleware">
<a id="to-another-middleware">to /another-middleware</a> to /another-middleware
</Link> </Link>
<br /> <br />
<Link href="/blog/slug-2"> <Link href="/blog/slug-2" id="to-blog-slug-2">
<a id="to-blog-slug-2">to /blog/slug-2</a> to /blog/slug-2
</Link> </Link>
<br /> <br />
</div> </div>
......
...@@ -5,12 +5,12 @@ export default function Page(props) { ...@@ -5,12 +5,12 @@ export default function Page(props) {
<div> <div>
<p id="index">root page</p> <p id="index">root page</p>
<p id="props">{JSON.stringify(props)}</p> <p id="props">{JSON.stringify(props)}</p>
<Link href="/another-middleware"> <Link href="/another-middleware" id="to-another-middleware">
<a id="to-another-middleware">to /another-middleware</a> to /another-middleware
</Link> </Link>
<br /> <br />
<Link href="/blog/slug-1"> <Link href="/blog/slug-1" id="to-blog-slug-1">
<a id="to-blog-slug-1">to /blog/slug-1</a> to /blog/slug-1
</Link> </Link>
<br /> <br />
</div> </div>
......
...@@ -4,42 +4,38 @@ export default function Home() { ...@@ -4,42 +4,38 @@ export default function Home() {
return ( return (
<div> <div>
<p className="title">Home Page</p> <p className="title">Home Page</p>
<Link href="/old-home"> <Link href="/old-home" id="old-home">
<a id="old-home">Redirect me to a new version of a page</a> Redirect me to a new version of a page
</Link> </Link>
<div /> <div />
<Link href="/old-home?override=external"> <Link href="/old-home?override=external" id="old-home-external">
<a id="old-home-external">Redirect me to an external site</a> Redirect me to an external site
</Link> </Link>
<div /> <div />
<Link href="/blank-page?foo=bar"> <Link href="/blank-page?foo=bar">Redirect me with URL params intact</Link>
<a>Redirect me with URL params intact</a>
</Link>
<div /> <div />
<Link href="/redirect-to-google"> <Link href="/redirect-to-google">
<a>Redirect me to Google (with no body response)</a> Redirect me to Google (with no body response)
</Link> </Link>
<div /> <div />
<Link href="/redirect-to-google"> <Link href="/redirect-to-google">
<a>Redirect me to Google (with no stream response)</a> Redirect me to Google (with no stream response)
</Link> </Link>
<div /> <div />
<Link href="/redirect-me-alot"> <Link href="/redirect-me-alot">Redirect me alot (chained requests)</Link>
<a>Redirect me alot (chained requests)</a>
</Link>
<div /> <div />
<Link href="/infinite-loop"> <Link href="/infinite-loop">Redirect me alot (infinite loop)</Link>
<a>Redirect me alot (infinite loop)</a>
</Link>
<div /> <div />
<Link href="/to?pathname=/api/ok" locale="nl"> <Link
<a id="link-to-api-with-locale">Redirect me to api with locale</a> href="/to?pathname=/api/ok"
locale="nl"
id="link-to-api-with-locale"
>
Redirect me to api with locale
</Link> </Link>
<div /> <div />
<Link href="/to?pathname=/old-home"> <Link href="/to?pathname=/old-home" id="link-to-to-old-home">
<a id="link-to-to-old-home">
Redirect me to a redirecting page of new version of page Redirect me to a redirecting page of new version of page
</a>
</Link> </Link>
<div /> <div />
</div> </div>
......
...@@ -4,60 +4,40 @@ export default function Home({ message }) { ...@@ -4,60 +4,40 @@ export default function Home({ message }) {
return ( return (
<div> <div>
<p className="title">Hello {message}</p> <p className="title">Hello {message}</p>
<Link href="/stream-a-response"> <Link href="/stream-a-response">Stream a response</Link>
<a>Stream a response</a>
</Link>
<div /> <div />
<Link href="/stream-long"> <Link href="/stream-long">Stream a long response</Link>
<a>Stream a long response</a> <Link href="/stream-end-stream">Test streaming after response ends</Link>
</Link>
<Link href="/stream-end-stream">
<a>Test streaming after response ends</a>
</Link>
<div /> <div />
<Link href="/stream-header-end"> <Link href="/stream-header-end">
<a>Attempt to add a header after stream ends</a> Attempt to add a header after stream ends
</Link> </Link>
<div /> <div />
<Link href="/redirect-stream"> <Link href="/redirect-stream">
<a>Redirect to Google and attempt to stream after</a> Redirect to Google and attempt to stream after
</Link> </Link>
<div /> <div />
<Link href="/header"> <Link href="/header">Respond with a header</Link>
<a>Respond with a header</a>
</Link>
<div /> <div />
<Link href="/header?nested-header=true"> <Link href="/header?nested-header=true">
<a>Respond with 2 headers (nested middleware effect)</a> Respond with 2 headers (nested middleware effect)
</Link> </Link>
<div /> <div />
<Link href="/body-end-header"> <Link href="/body-end-header">Respond with body, end, set a header</Link>
<a>Respond with body, end, set a header</a>
</Link>
<div /> <div />
<Link href="/body-end-body"> <Link href="/body-end-body">
<a>Respond with body, end, send another body</a> Respond with body, end, send another body
</Link> </Link>
<div /> <div />
<Link href="/send-response"> <Link href="/send-response">Respond with body</Link>
<a>Respond with body</a>
</Link>
<div /> <div />
<Link href="/redirect-body"> <Link href="/redirect-body">Redirect and then send a body</Link>
<a>Redirect and then send a body</a>
</Link>
<div /> <div />
<Link href="/react"> <Link href="/react">Send React component as a body</Link>
<a>Send React component as a body</a>
</Link>
<div /> <div />
<Link href="/react-stream"> <Link href="/react-stream">Stream React component</Link>
<a>Stream React component</a>
</Link>
<div /> <div />
<Link href="/bad-status"> <Link href="/bad-status">404</Link>
<a>404</a>
</Link>
<div /> <div />
</div> </div>
) )
......
...@@ -9,12 +9,16 @@ export default function Page(props) { ...@@ -9,12 +9,16 @@ export default function Page(props) {
return ( return (
<> <>
<p id="props">{JSON.stringify(props)}</p> <p id="props">{JSON.stringify(props)}</p>
<Link href="/fallback-true-blog/first?hello=world" shallow> <Link
<a id="to-query-shallow">to /fallback-true-blog/first?hello=world</a> href="/fallback-true-blog/first?hello=world"
shallow
id="to-query-shallow"
>
to /fallback-true-blog/first?hello=world
</Link> </Link>
<br /> <br />
<Link href="/fallback-true-blog/second" shallow> <Link href="/fallback-true-blog/second" shallow id="to-no-query-shallow">
<a id="to-no-query-shallow">to /fallback-true-blog/second</a> to /fallback-true-blog/second
</Link> </Link>
<br /> <br />
</> </>
......
...@@ -6,28 +6,28 @@ export default function Home({ locale }) { ...@@ -6,28 +6,28 @@ export default function Home({ locale }) {
<div className={locale}>{locale}</div> <div className={locale}>{locale}</div>
<ul> <ul>
<li> <li>
<Link href="/i18n" locale="en"> <Link href="/i18n" locale="en" id="link-en">
<a id="link-en">Go to en</a> Go to en
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/en/i18n" locale={false}> <Link href="/en/i18n" locale={false} id="link-en2">
<a id="link-en2">Go to en2</a> Go to en2
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/i18n" locale="ja"> <Link href="/i18n" locale="ja" id="link-ja">
<a id="link-ja">Go to ja</a> Go to ja
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/ja/i18n" locale={false}> <Link href="/ja/i18n" locale={false} id="link-ja2">
<a id="link-ja2">Go to ja2</a> Go to ja2
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/i18n" locale="fr"> <Link href="/i18n" locale="fr" id="link-fr">
<a id="link-fr">Go to fr</a> Go to fr
</Link> </Link>
</li> </li>
</ul> </ul>
......
...@@ -7,48 +7,52 @@ export default function Home() { ...@@ -7,48 +7,52 @@ export default function Home() {
<div> <div>
<p className="title">Home Page</p> <p className="title">Home Page</p>
<div /> <div />
<Link href="/rewrite-to-ab-test"> <Link href="/rewrite-to-ab-test">A/B test homepage</Link>
<a>A/B test homepage</a>
</Link>
<div /> <div />
<Link href="/rewrite-me-to-about?override=internal"> <Link
<a id="rewrite-me-to-about">Rewrite me to about</a> href="/rewrite-me-to-about?override=internal"
id="rewrite-me-to-about"
>
Rewrite me to about
</Link> </Link>
<div /> <div />
<Link href="/rewrite-to-beforefiles-rewrite"> <Link
<a id="rewrite-to-beforefiles-rewrite"> href="/rewrite-to-beforefiles-rewrite"
id="rewrite-to-beforefiles-rewrite"
>
Rewrite me to beforeFiles Rewrite Rewrite me to beforeFiles Rewrite
</a>
</Link> </Link>
<div /> <div />
<Link href="/rewrite-to-afterfiles-rewrite"> <Link
<a id="rewrite-to-afterfiles-rewrite"> href="/rewrite-to-afterfiles-rewrite"
id="rewrite-to-afterfiles-rewrite"
>
Rewrite me to afterFiles Rewrite Rewrite me to afterFiles Rewrite
</a>
</Link> </Link>
<div /> <div />
<Link href="/rewrite-me-to-vercel"> <Link href="/rewrite-me-to-vercel">Rewrite me to Vercel</Link>
<a>Rewrite me to Vercel</a>
</Link>
<div /> <div />
<Link href="/rewrite-me-external-twice"> <Link href="/rewrite-me-external-twice">
<a>Redirect me to Vercel (but with double reroutes)</a> Redirect me to Vercel (but with double reroutes)
</Link> </Link>
<div /> <div />
<Link href="/rewrite-me-without-hard-navigation?message=refreshed"> <Link
<a id="link-with-rewritten-url">Rewrite me without a hard navigation</a> href="/rewrite-me-without-hard-navigation?message=refreshed"
id="link-with-rewritten-url"
>
Rewrite me without a hard navigation
</Link> </Link>
<div /> <div />
<Link href="/about?override=external"> <Link href="/about?override=external" id="override-with-external-rewrite">
<a id="override-with-external-rewrite">Rewrite me to external site</a> Rewrite me to external site
</Link> </Link>
<div /> <div />
<Link href="/about?override=internal"> <Link href="/about?override=internal" id="override-with-internal-rewrite">
<a id="override-with-internal-rewrite">Rewrite me to internal path</a> Rewrite me to internal path
</Link> </Link>
<div /> <div />
<Link href="/ssg"> <Link href="/ssg" id="normal-ssg-link">
<a id="normal-ssg-link">normal SSG link</a> normal SSG link
</Link> </Link>
<div /> <div />
<a <a
......
...@@ -3,8 +3,8 @@ import Link from 'next/link' ...@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Errors() { export default function Errors() {
return ( return (
<div> <div>
<Link href="/error-throw?message=refreshed"> <Link href="/error-throw?message=refreshed" id="throw-on-data">
<a id="throw-on-data">Throw on data</a> Throw on data
</Link> </Link>
</div> </div>
) )
......
...@@ -8,13 +8,13 @@ export default function Shallow({ message }) { ...@@ -8,13 +8,13 @@ export default function Shallow({ message }) {
<ul> <ul>
<li id="message-contents">{message}</li> <li id="message-contents">{message}</li>
<li> <li>
<Link href="/sha?hello=world" shallow> <Link href="/sha?hello=world" shallow id="shallow-link">
<a id="shallow-link">Shallow link to ?hello=world</a> Shallow link to ?hello=world
</Link> </Link>
</li> </li>
<li> <li>
<Link href="/sha?hello=goodbye"> <Link href="/sha?hello=goodbye" id="deep-link">
<a id="deep-link">Deep link to ?hello=goodbye</a> Deep link to ?hello=goodbye
</Link> </Link>
</li> </li>
<li> <li>
......
module.exports = { module.exports = {}
experimental: {
newNextLinkBehavior: true,
},
}
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
} }
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
} }
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment