-
-
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] load function should not leak props
When navigating from a page with a load() function to a page without a load() function, props were not being reset, so if the second page had a prop with the same name as the prop returned by the first page's load() function, the second page would receive the same prop that the first page did.
- Loading branch information
Showing
6 changed files
with
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[fix] load function should not leak props to other components |
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
10 changes: 10 additions & 0 deletions
10
packages/kit/test/apps/basics/src/routes/load/props/__layout.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,10 @@ | ||
<header> | ||
<nav> | ||
<a href="/load/props/">Index</a> | ||
<a href="/load/props/about">About</a> | ||
</nav> | ||
</header> | ||
|
||
<main> | ||
<slot /> | ||
</main> |
7 changes: 7 additions & 0 deletions
7
packages/kit/test/apps/basics/src/routes/load/props/about.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,7 @@ | ||
<script> | ||
export let data; | ||
</script> | ||
|
||
<h3>About</h3> | ||
|
||
<p>Data: {data}</p> |
14 changes: 14 additions & 0 deletions
14
packages/kit/test/apps/basics/src/routes/load/props/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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script context="module"> | ||
export async function load() { | ||
const data = 'Hello from Index!'; | ||
return { props: { data } }; | ||
} | ||
</script> | ||
|
||
<script> | ||
export let data; | ||
</script> | ||
|
||
<h3>Index</h3> | ||
|
||
<p>Data: {data}</p> |