Closed pixelmund closed 2 years ago
It looks like the culprit is https://github.com/sveltejs/kit/blob/647131e00149cb5299042eedeb880efcd855a2df/packages/kit/src/runtime/client/renderer.js#L756
If url.pathname
is /
, we need to make sure we're not fetching //__data.json
, which will be interpreted as a protocol-relative URL. This would probably also be an issue with other paths ending in a /
(if https://kit.svelte.dev/docs#configuration-trailingslash were set so as to allow that to happen).
~I had to get around this by using rel="external"
.~
Using rel="external"
resolves the problem when clicking on internal links. I'm not sure if there's a temporary solution for dealing with the currently broken browser back navigation function.
Yep, quick workaround is manually edit the node_modules/@sveltejs/kit/assets/client/start.js~1269
:
const res = await fetch(`${url.pathname == '/' ? '' : url.pathname}/__data.json`, {
Describe the bug
Hey, i've noticed that the shadow endpoints are broken if you try to navigate back with the default browser navigation, it tries to fetch http://__data.json/.
EDIT: This seems to be happening on every client side navigation.
Reproduction
https://github.com/pixelmund/shadow-endpoints-repro
Steps to reproduce:
2nd Method without pulling the repo:
The error is cause because the browser tries to fetch http://__data.json/.
Logs
System Info
Severity
blocking an upgrade
Additional Information
No response