-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] prerendered endpoint callable from non-prerendered server load (#…
- Loading branch information
1 parent
0f283b8
commit 9c01c32
Showing
6 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[fix] prerendered endpoint callable from non-prerendered server load |
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
7 changes: 7 additions & 0 deletions
7
packages/kit/test/apps/basics/src/routes/prerendering/prerendered-endpoint/api/+server.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,7 @@ | ||
import { json } from '@sveltejs/kit'; | ||
|
||
export const prerender = true; | ||
|
||
export function GET() { | ||
return json({ message: 'Im prerendered and called from a non-prerendered +page.server.js' }); | ||
} |
6 changes: 6 additions & 0 deletions
6
...es/kit/test/apps/basics/src/routes/prerendering/prerendered-endpoint/page/+page.server.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,6 @@ | ||
/** @type {import('./$types').PageServerLoad} */ | ||
export async function load({ fetch }) { | ||
const res = await fetch('/prerendering/prerendered-endpoint/api'); | ||
const json = await res.json(); | ||
return json; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/kit/test/apps/basics/src/routes/prerendering/prerendered-endpoint/page/+page.svelte
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,5 @@ | ||
<script> | ||
export let data; | ||
</script> | ||
|
||
<h1>{data.message}</h1> |
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