mirror of https://github.com/sveltejs/svelte
fix: repair `href` attribute mismatches (#13032)
* fix: repair `href` attribute mismatches
The reasoning in #9662 turns out to be false: While it's true that the href would resolve to the same URL on the initial page, once you're doing a client-side navigation to a URL at a different depth, the relative path would now point to the wrong location. Therefore we need to repair href hydration mismatches
fixes https://github.com/sveltejs/kit/issues/12254
* remove test
* Revert "remove test"
This reverts commit fa43304329
.
* fix test
* remove comment, since the rationale for skipping the attributes in question is covered by the one immediately below
* fix
* add test for <a> specifically
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/13036/head
parent
c4b721584a
commit
e03dae95da
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: repair `href` attribute mismatches
|
@ -0,0 +1,11 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
server_props: {
|
||||||
|
browser: false
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
browser: true
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1 @@
|
|||||||
|
<!--[--><a href="/foo">foo</a><!--]-->
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let { browser } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a href={browser ? '/foo' : '/bar'}>foo</a>
|
Loading…
Reference in new issue