-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve page through dynamic() #10
Comments
You didn't show how are your imports, but I'm guessing some of them are lazily loaded and others not? If this is the case, it's due to issue #7 - |
All of them are just imported like this: <script>
import Component from "../lib/components/Component.svelte";
import Component2 from "../lib/components/Component2.svelte";
</script> I don't think any of them were lazily loaded, unless again I've missed something. I did switch over to the |
Ok, got it now. The problem is a leftover in the docs, where I wrote about support for a third param in the routes array: <!-- You can pass optional props that will be passed to the component such as in the '/blog/:post' route below -->
<svelte:component this={dynamic($path, [
['/', Home],
['/about', About],
['/blog', Blog],
['/blog/:post', Post, {id: $params['post']}],
], Error)} /> Due to that, you followed the docs and tried: ["/chara/:id", CharaSingle, { id: $params["id"] }] ... but if you see the console screen for your sample project, there is an error: ... which is the third, actually unsupported parameter, being passed inside the route. To fix this, please do like this in your ```["/chara/:id", CharaSingle]`` The reason was, when I was about to release the version implementing <svelte:component this={dynamic($path, routes)} /> because the props returns from So, I'm sorry about the leftover mistake, and I've fixed the documentation. I wrote the |
Oh I see! That makes a lot of sense. It's no worries, thanks for the clarification and help. |
Hello! I'm building out a POC with Elegua and Vite + Svelte, but I ran into an issue with dynamic routing. Whenever I use a named params route in the list of routes for the
dynamic()
method, Vite HMR freezes up and fails to render anything.I'm unsure if I set up my routes wrong, but here's the gist of how it looks like on my end:
in
App.svelte
:in
CharaSingle.svelte
:But if I place the
CharaSingle
component inside anif
block, it renders with no issues:I set up a stackblitz project to showcase the issue here: https://stackblitz.com/edit/vitejs-vite-ur49yb?file=src%2FApp.svelte
Is there something I'm missing? Please let me know.
The text was updated successfully, but these errors were encountered: