-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
in #13032 @dummdidumm talks about when href are server side generated they are rendered with relative paths, however on the client they need to be absolute so when the application hydrates it replaces the href with an absolute instead of a relative.
It creates a bit of an edge case where if you put links in a layout file and navigate up/down the paths break if they are not absolute.
It appears that if you use resolveRoute and a component that spread in href on the a tag, this functionality breaks.
Reproduction
I've created a simple example here It includes 3 links in the layout file
If you serve the app and go to /bar and inspect the links, you can see that 2 of them has been hydrated from relative -> absolute urls, however the third has not.
Here is the LinkButton component for simplicity

Changing it to this

solves the issue
Logs
System Info
System:
OS: macOS 15.2
CPU: (10) arm64 Apple M1 Pro
Memory: 719.09 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
Browsers:
Chrome: 131.0.6778.265
Safari: 18.2
npmPackages:
svelte: ^5.0.0 => 5.19.3Severity
annoyance

