You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When navigating from one page to another, the old page component is briefly updated with the new page's props before the new page component is swapped in. This causes undefined errors since the old page doesn't have its expected props any longer.
I'm not sure if this is expected behavior, or if it's specific to Svelte 5. This happens when using $props() and $page.props.
Steps to reproduce:
Create two pages link to each other and each receives unique props.
// One.svelte
<script>
import { Link } from"@inertiajs/svelte";let { propOne } =$props(); // set to "prop-one-value" on the server$inspect("One", propOne);
</script>
<Linkhref="/two">Two</Link>
// Two.svelte
<script>
import { Link } from"@inertiajs/svelte";let { propTwo } =$props(); // set to "prop-two-value" on the server$inspect("Two", propTwo);
</script>
<Linkhref="/one">One</Link>
In the browser, navigate using the links and you'll see the following in the console.
init One prop-one-value
update One undefined
init Two prop-two-value
update Two undefined
init One prop-one-value
...
The text was updated successfully, but these errors were encountered:
Version:
@inertiajs/svelte
version: 2.0.0 and 1.3.0svelte
version: 5.16.0Describe the problem:
When navigating from one page to another, the old page component is briefly updated with the new page's props before the new page component is swapped in. This causes undefined errors since the old page doesn't have its expected props any longer.
I'm not sure if this is expected behavior, or if it's specific to Svelte 5. This happens when using
$props()
and$page.props
.Steps to reproduce:
Create two pages link to each other and each receives unique props.
In the browser, navigate using the links and you'll see the following in the console.
The text was updated successfully, but these errors were encountered: