-
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.
Merge branch 'canary' into bump-turbopack
- Loading branch information
Showing
17 changed files
with
242 additions
and
98 deletions.
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
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
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
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
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
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
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
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
40 changes: 16 additions & 24 deletions
40
packages/next/src/server/future/route-modules/helpers/response-handlers.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 |
---|---|---|
@@ -1,37 +1,29 @@ | ||
export function handleTemporaryRedirectResponse(url: string): Response { | ||
return new Response(null, { | ||
status: 302, | ||
statusText: 'Found', | ||
headers: { | ||
location: url, | ||
}, | ||
}) | ||
import { appendMutableCookies } from '../../../web/spec-extension/adapters/request-cookies' | ||
import { ResponseCookies } from '../../../web/spec-extension/cookies' | ||
|
||
export function handleTemporaryRedirectResponse( | ||
url: string, | ||
mutableCookies: ResponseCookies | ||
): Response { | ||
const headers = new Headers({ location: url }) | ||
|
||
appendMutableCookies(headers, mutableCookies) | ||
|
||
return new Response(null, { status: 307, headers }) | ||
} | ||
|
||
export function handleBadRequestResponse(): Response { | ||
return new Response(null, { | ||
status: 400, | ||
statusText: 'Bad Request', | ||
}) | ||
return new Response(null, { status: 400 }) | ||
} | ||
|
||
export function handleNotFoundResponse(): Response { | ||
return new Response(null, { | ||
status: 404, | ||
statusText: 'Not Found', | ||
}) | ||
return new Response(null, { status: 404 }) | ||
} | ||
|
||
export function handleMethodNotAllowedResponse(): Response { | ||
return new Response(null, { | ||
status: 405, | ||
statusText: 'Method Not Allowed', | ||
}) | ||
return new Response(null, { status: 405 }) | ||
} | ||
|
||
export function handleInternalServerErrorResponse(): Response { | ||
return new Response(null, { | ||
status: 500, | ||
statusText: 'Internal Server Error', | ||
}) | ||
return new Response(null, { status: 500 }) | ||
} |
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
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
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 @@ | ||
import { draftMode } from 'next/headers' | ||
import { redirect } from 'next/navigation' | ||
|
||
export function GET() { | ||
draftMode().enable() | ||
return redirect('/some-other-page') | ||
} |
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
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/e2e/app-dir/navigation/app/hash-link-back-to-same-page/other/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 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<p>Other Page</p> | ||
<Link href="/hash-link-back-to-same-page" id="link-to-home"> | ||
Back to test home | ||
</Link> | ||
</> | ||
) | ||
} |
Oops, something went wrong.