-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve hydration of svelte head blocks (#11099)
* fix: improve hydration of svelte head blocks * revert sandbox * simplify
- Loading branch information
Showing
8 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte": patch | ||
--- | ||
|
||
fix: improve hydration of svelte head blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/runtime-runes/samples/multiple-head/MetaTag.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script> | ||
let title = $state('Hello world'); | ||
let desc = $state('Some description'); | ||
</script> | ||
<svelte:head> | ||
<title>{title}</title> | ||
<meta name="description" content={desc}> | ||
<meta name="author" content="@svelteawesome"> | ||
</svelte:head> |
12 changes: 12 additions & 0 deletions
12
packages/svelte/tests/runtime-runes/samples/multiple-head/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `<div>Hello</div>`, | ||
|
||
async test({ assert, target }) { | ||
assert.htmlEqual( | ||
target.ownerDocument.head.innerHTML, | ||
`<script async="" src="https://www.googletagmanager.com/gtag/js?id=12345"></script><meta content="Some description" name="description"><meta content="@svelteawesome" name="author"><title>Hello world</title>` | ||
); | ||
} | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/runtime-runes/samples/multiple-head/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script> | ||
import MetaTag from './MetaTag.svelte' | ||
</script> | ||
<svelte:head> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id=12345"></script> | ||
</svelte:head> | ||
<MetaTag /> | ||
|
||
<div>Hello</div> |
2 changes: 1 addition & 1 deletion
2
...velte/tests/server-side-rendering/samples/head-meta-hydrate-duplicate/_expected-head.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<!ssr:0> | ||
<title>Some Title</title> | ||
<link rel="canonical" href="/"> | ||
<meta name="description" content="some description"> | ||
<meta name="keywords" content="some keywords"> | ||
<title>Some Title</title> | ||
<!ssr:0> |