-
-
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.
only inline data if hydrate=true (#837)
* only inline data if hydrate=true * changeset
- Loading branch information
Rich Harris
authored
Apr 2, 2021
1 parent
4d2cd62
commit 6384af6
Showing
5 changed files
with
41 additions
and
5 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 | ||
--- | ||
|
||
Only inline data if hydrate=true |
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
7 changes: 7 additions & 0 deletions
7
packages/kit/test/apps/basics/src/routes/hydrate/index.json.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 @@ | ||
export function get() { | ||
return { | ||
body: { | ||
type: 'hydrate' | ||
} | ||
}; | ||
} |
17 changes: 16 additions & 1 deletion
17
packages/kit/test/apps/basics/src/routes/hydrate/index.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 |
---|---|---|
@@ -1,13 +1,28 @@ | ||
<script context="module"> | ||
export const hydrate = false; | ||
/** @type {import('../../../../../../types').Load} */ | ||
export async function load({ fetch }) { | ||
const res = await fetch('/hydrate.json'); | ||
/** @type {any} */ | ||
const { type } = await res.json(); | ||
return { | ||
props: { type } | ||
} | ||
} | ||
</script> | ||
|
||
<script> | ||
/** @type {string} */ | ||
export let type; | ||
let n = 0; | ||
</script> | ||
|
||
<button on:click={() => n += 1}> | ||
clicks: {n} | ||
</button> | ||
|
||
<a href="/hydrate/other">other</a> | ||
<a href="/{type}/other">other</a> |