-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: prerender pages adjacent to endpoints #15621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
643b00a
Fixes #15620
aenriii bec5e62
Ran pnpm lint
aenriii 4c274a3
made changeset, added add'l check to prerender.js, and edited test na…
aenriii 7e47854
fixed typecheck fail with new field to ServerMetadataRoute.[api,page]
aenriii bacebc6
should pass pnpm lint now, forgot to fix that
aenriii f7aeeb8
fixed regression featuring me accidentally ===ing a value that only n…
aenriii f42df3b
Update .changeset/brown-eggs-march.md
aenriii 79df286
Apply suggestions from code review
teemingc c0d12bd
Apply suggestions from code review
teemingc 02257d0
Apply suggestions from code review
teemingc ac842d5
simplify
teemingc 4caad8b
unused type
teemingc 10e2cc5
whoops
teemingc 116467f
tweak: expect_html -> false when crawling
aenriii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@sveltejs/kit': patch | ||
| --- | ||
|
|
||
| fix: prerender pages that share the same route as a `+server.js` file even if it does not export a `GET` method |
This file contains hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
packages/kit/test/prerendering/basics/src/routes/duplicate-get/+page.svelte
This file contains hidden or 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 @@ | ||
| <h1>prerendered page with server endpoint</h1> |
5 changes: 5 additions & 0 deletions
5
packages/kit/test/prerendering/basics/src/routes/duplicate-get/+server.js
This file contains hidden or 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,5 @@ | ||
| export function GET() { | ||
| return new Response(JSON.stringify({ ok: true }), { | ||
| headers: { 'content-type': 'application/json' } | ||
| }); | ||
| } |
1 change: 1 addition & 0 deletions
1
packages/kit/test/prerendering/basics/src/routes/get-and-post/+page.svelte
This file contains hidden or 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 @@ | ||
| Hello World... |
3 changes: 3 additions & 0 deletions
3
packages/kit/test/prerendering/basics/src/routes/get-and-post/+server.ts
This file contains hidden or 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,3 @@ | ||
| export async function POST() { | ||
| return new Response('OK', { status: 200 }); | ||
| } |
5 changes: 5 additions & 0 deletions
5
packages/kit/test/prerendering/basics/src/routes/linked-api/+page.svelte
This file contains hidden or 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,5 @@ | ||
| <script> | ||
| import { resolve } from '$app/paths'; | ||
| </script> | ||
|
|
||
| <a href={resolve('/linked-api/my-awesome-endpoint.json')}>My Awesome Endpoint</a> |
7 changes: 7 additions & 0 deletions
7
...es/kit/test/prerendering/basics/src/routes/linked-api/my-awesome-endpoint.json/+server.js
This file contains hidden or 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 const prerender = true; | ||
|
|
||
| export function GET() { | ||
| return new Response(JSON.stringify({ ok: true }), { | ||
| headers: { 'content-type': 'application/json' } | ||
| }); | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes even without the PR's fix. Do we really need it? Even if the endpoint wasn't discovered while crawling the page, the prerenderer would prerender the endpoint because it detects the exported
prerenderpage option during analysis.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean I see no harm done in keeping it, I put it there in part because I knew my code changed the behavior there and I wanted to be sure that there was no regression happening on my behalf. Fully up to yall.