Persistent layouts using Svelte and Vite throwing error on page switch. Initial load works fine. #1456
Unanswered
Aigarsss
asked this question in
Help (Svelte)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm trying to implement the inertia persistent layouts for Svelte, however, I'm running into some issues.
If I run everything using layouts as parent component, it works fine.
Then just wrap the components in the Layout component:
I can navigate the nav links, and all is okay.
But when I try the persistent layouts, I cannot navigate the menu items, because I get very weird/cryptic js errors.
The setup:
If I open the web page, it works fine and loads. But if I try to click any of the items in the menu (they are all InertiaLink), I get errors.
Here is an example:
I am on a page localhost/users, which receives the following props:
and the view loads fine on the initial load. But if I then try to navigate to localhost/users/1/edit, I get stuck on the initial /users page, and the error in the console is:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
If I click the error it drills down to this:
Which would imply, that it is, for some reason, trying to do something, with the props of the previous component, rather than the new one. These are the props used in /edit -
$: user = $page.props.editUserData;
, so it should not look for data/links props.I also tried to use the
<script context="module">
approach, which had the same exact effect.Any ideas or suggestions how to troubleshoot would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions