-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix: #42398 relates to #42626 (review) <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: JJ Kasper <[email protected]>
- Loading branch information
1 parent
22b16e1
commit 4d2b7e5
Showing
6 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/production/app-dir-prefetch-non-iso-url/app/[slug]/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default function Slug(props) { | ||
return ( | ||
<> | ||
<p id="page">/[slug]</p> | ||
<p id="props">{JSON.stringify(props)}</p> | ||
</> | ||
) | ||
} | ||
|
||
export function generateStaticParams() { | ||
return [{ slug: 'iso-url' }, { slug: 'кириллица' }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Layout({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Page(props) { | ||
return ( | ||
<> | ||
<p id="page">index</p> | ||
<p id="props">{JSON.stringify(props)}</p> | ||
<Link href="/iso-url" id="to-iso"> | ||
/iso-url | ||
</Link> | ||
<br /> | ||
<Link href="/кириллица" id="to-non-iso"> | ||
/кириллица | ||
</Link> | ||
<br /> | ||
</> | ||
) | ||
} |
48 changes: 48 additions & 0 deletions
48
test/production/app-dir-prefetch-non-iso-url/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { join } from 'path' | ||
import { BrowserInterface } from '../../lib/browsers/base' | ||
import webdriver from 'next-webdriver' | ||
import { check } from 'next-test-utils' | ||
|
||
describe('app-dir-prefetch-non-iso-url', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
'next.config.js': new FileRef(join(__dirname, 'next.config.js')), | ||
app: new FileRef(join(__dirname, 'app')), | ||
}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should go to iso url', async () => { | ||
let browser: BrowserInterface | ||
|
||
try { | ||
browser = await webdriver(next.appPort, '/') | ||
await browser.elementByCss('#to-iso').click() | ||
await check(() => browser.elementByCss('#page').text(), '/[slug]') | ||
} finally { | ||
if (browser) { | ||
await browser.close() | ||
} | ||
} | ||
}) | ||
|
||
it('should go to non-iso url', async () => { | ||
let browser: BrowserInterface | ||
|
||
try { | ||
browser = await webdriver(next.appPort, '/') | ||
await browser.elementByCss('#to-non-iso').click() | ||
await check(() => browser.elementByCss('#page').text(), '/[slug]') | ||
} finally { | ||
if (browser) { | ||
await browser.close() | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import("next").NextConfig} */ | ||
const nextConfig = { | ||
experimental: { appDir: true }, | ||
} | ||
|
||
module.exports = nextConfig |