CSR and SSR URL mismatch with rewrites #5093
Labels
bug
Something isn't working
help wanted
PRs welcomed. The implementation details are unlikely to cause debate
low hanging fruit
p1-important
SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
Milestone
Describe the bug
It seems that the
$page.url.pathname
is incorrect on the server when using a rewrite — instead of returning theURL
of the source URL, it returns thatURL
of the destination URL (but only on the server). This can cause CLS.Here's a video demo of the issue.
Here's the deploy URL as a demo. Try hard reloading this page (notice
/rewrite
). The$page.url.pathname
is different on the client and the server when rendering on the server. It causes the Current Path to flash.For reference, Next will do the same thing. However, when developing locally, it throws a hydration error.
Reproduction
https://github.com/phultquist/svelte-ssr-pathname-bug
Note, when developing locally, use
vercel dev
instead ofnpm run dev
Logs
System Info
Severity
annoyance
Additional Information
I'm not well-versed to the Svelte repository — but it looks like it's coming from this line (if that helps at all 😄).
The text was updated successfully, but these errors were encountered: