Unable to navigate to non-root routes by links
See original GitHub issueDescribe the bug
When navigating to a page that isn’t /
(e.g /blog
and /works
) using links, the page being rendered is the $error
one. But you can navigate to /
perfectly well.
Also, if this error shows up and you reload the page, the page renders fine, but then if you navigate to any non-/
page and come back, its again $error
Logs Screenshot
Text:
<$error> received an unexpected slot "default".
$error.svelte? [sm]:6 <$error> was created with unknown prop 'blogsList'
To Reproduce Repro: https://github.com/PuruVJ/sveltekit-error-repro
Run npm run dev
Then visit /
on localhost
Then click on the link.
You should see this
Reload: You’ll see the page perfectly and the data will be logged to console. Go to Home by clicking on the link, then come back to /blog
by clicking the link on home. Again the error will be there
Expected behavior When I should navigate by links to any of these routes, the correct component should render and I should see the page, irrespective of which page I’m navigating from and how many times
Information about your SvelteKit Installation:
Diagnostics
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Memory: 1000.34 MB / 7.86 GB
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
npmPackages:
@sveltejs/kit: ^1.0.0-next.100 => 1.0.0-next.100
svelte: ^3.38.2 => 3.38.2
vite: ^2.2.4 => 2.2.4
-
Your browser - Brave
-
Your adapter- @sveltejs/adapter-static
Severity High severity. Unable to run Dev properly, plus it is breaking the prod build too(My assumption)
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (4 by maintainers)
Top GitHub Comments
NVM figured it out
Oh, yeah, you’re right, it’s because of the absence of trailing slash. How foolish of me 😄, sorry.