-
-
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] Fix hydration duplicate
svelte:head
tag issue with @html
ex…
…pressions and nested components (#7745) * Fix hydration duplicate `svelte:head` tag issue with `@html` and nested components #7444 #6463 * - Changed comment style to HEAD_${head_id}_START and HEAD_${head_id}_END - Improved claim logic - Changed tests accordingly
- Loading branch information
Maximiliano Ruani
authored
Sep 11, 2022
1 parent
7ac3854
commit 8ffc8fd
Showing
19 changed files
with
110 additions
and
15 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
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
2 changes: 2 additions & 0 deletions
2
test/hydration/samples/head-html-and-component/HeadNested.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,2 @@ | ||
{@html '<meta name="head_nested_html" content="head_nested_html">'} | ||
<meta name="head_nested" content="head_nested"> |
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:head> | ||
{@html '<meta name="nested_html" content="nested_html">'} | ||
<meta name="nested" content="nested"> | ||
</svelte:head> |
Empty file.
12 changes: 12 additions & 0 deletions
12
test/hydration/samples/head-html-and-component/_after_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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- HEAD_svelte-17ibcve_START --> | ||
<!-- HTML_TAG_START --><meta name="main_html" content="main_html"><!-- HTML_TAG_END --> | ||
<meta name="main" content="main"> | ||
<!-- HTML_TAG_START --><meta name="head_nested_html" content="head_nested_html"><!-- HTML_TAG_END --> | ||
<meta name="head_nested" content="head_nested"> | ||
<!-- HEAD_svelte-17ibcve_END --> | ||
|
||
<!-- HEAD_svelte-1gqzvnn_START --> | ||
<!-- HTML_TAG_START --><meta name="nested_html" content="nested_html"><!-- HTML_TAG_END --> | ||
<meta name="nested" content="nested"> | ||
<!-- HEAD_svelte-1gqzvnn_END --> | ||
|
Empty file.
11 changes: 11 additions & 0 deletions
11
test/hydration/samples/head-html-and-component/_before_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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- HEAD_svelte-17ibcve_START --> | ||
<!-- HTML_TAG_START --><meta name="main_html" content="main_html"><!-- HTML_TAG_END --> | ||
<meta name="main" content="main"> | ||
<!-- HTML_TAG_START --><meta name="head_nested_html" content="head_nested_html"><!-- HTML_TAG_END --> | ||
<meta name="head_nested" content="head_nested"> | ||
<!-- HEAD_svelte-17ibcve_END --> | ||
|
||
<!-- HEAD_svelte-1gqzvnn_START --> | ||
<!-- HTML_TAG_START --><meta name="nested_html" content="nested_html"><!-- HTML_TAG_END --> | ||
<meta name="nested" content="nested"> | ||
<!-- HEAD_svelte-1gqzvnn_END --> |
12 changes: 12 additions & 0 deletions
12
test/hydration/samples/head-html-and-component/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,12 @@ | ||
<script> | ||
import HeadNested from './HeadNested.svelte'; | ||
import Nested from './Nested.svelte'; | ||
</script> | ||
|
||
<svelte:head> | ||
{@html '<meta name="main_html" content="main_html">'} | ||
<meta name="main" content="main"> | ||
<HeadNested /> | ||
</svelte:head> | ||
|
||
<Nested/> |
8 changes: 5 additions & 3 deletions
8
test/hydration/samples/head-meta-hydrate-duplicate/_after_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,4 +1,6 @@ | ||
<title>Some Title</title> | ||
<link href="/" rel="canonical"> | ||
<meta content="some description" name="description"> | ||
<meta content="some keywords" name="keywords"> | ||
<!-- HEAD_svelte-1s8aodm_START --> | ||
<link rel="canonical" href="/"> | ||
<meta name="description" content="some description"> | ||
<meta name="keywords" content="some keywords"> | ||
<!-- HEAD_svelte-1s8aodm_END --> |
8 changes: 5 additions & 3 deletions
8
test/hydration/samples/head-meta-hydrate-duplicate/_before_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,4 +1,6 @@ | ||
<title>Some Title</title> | ||
<link rel="canonical" href="/" data-svelte="svelte-1s8aodm"> | ||
<meta name="description" content="some description" data-svelte="svelte-1s8aodm"> | ||
<meta name="keywords" content="some keywords" data-svelte="svelte-1s8aodm"> | ||
<!-- HEAD_svelte-1s8aodm_START --> | ||
<link rel="canonical" href="/"> | ||
<meta name="description" content="some description"> | ||
<meta name="keywords" content="some keywords"> | ||
<!-- HEAD_svelte-1s8aodm_END --> |
2 changes: 2 additions & 0 deletions
2
test/server-side-rendering/samples/head-html-and-component/HeadNested.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,2 @@ | ||
{@html '<meta name="head_nested_html" content="head_nested_html">'} | ||
<meta name="head_nested" content="head_nested"> |
5 changes: 5 additions & 0 deletions
5
test/server-side-rendering/samples/head-html-and-component/Nested.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,5 @@ | ||
|
||
<svelte:head> | ||
{@html '<meta name="nested_html" content="nested_html">'} | ||
<meta name="nested" content="nested"> | ||
</svelte:head> |
11 changes: 11 additions & 0 deletions
11
test/server-side-rendering/samples/head-html-and-component/_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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- HEAD_svelte-17ibcve_START --> | ||
<!-- HTML_TAG_START --><meta name="main_html" content="main_html"><!-- HTML_TAG_END --> | ||
<meta name="main" content="main"> | ||
<!-- HTML_TAG_START --><meta name="head_nested_html" content="head_nested_html"><!-- HTML_TAG_END --> | ||
<meta name="head_nested" content="head_nested"> | ||
<!-- HEAD_svelte-17ibcve_END --> | ||
|
||
<!-- HEAD_svelte-1gqzvnn_START --> | ||
<!-- HTML_TAG_START --><meta name="nested_html" content="nested_html"><!-- HTML_TAG_END --> | ||
<meta name="nested" content="nested"> | ||
<!-- HEAD_svelte-1gqzvnn_END --> |
Empty file.
12 changes: 12 additions & 0 deletions
12
test/server-side-rendering/samples/head-html-and-component/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,12 @@ | ||
<script> | ||
import HeadNested from './HeadNested.svelte'; | ||
import Nested from './Nested.svelte'; | ||
</script> | ||
|
||
<svelte:head> | ||
{@html '<meta name="main_html" content="main_html">'} | ||
<meta name="main" content="main"> | ||
<HeadNested /> | ||
</svelte:head> | ||
|
||
<Nested/> |
8 changes: 5 additions & 3 deletions
8
test/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,4 +1,6 @@ | ||
<title>Some Title</title> | ||
<link rel="canonical" href="/" data-svelte="svelte-1s8aodm"> | ||
<meta name="description" content="some description" data-svelte="svelte-1s8aodm"> | ||
<meta name="keywords" content="some keywords" data-svelte="svelte-1s8aodm"> | ||
<!-- HEAD_svelte-1s8aodm_START --> | ||
<link rel="canonical" href="/"> | ||
<meta name="description" content="some description"> | ||
<meta name="keywords" content="some keywords"> | ||
<!-- HEAD_svelte-1s8aodm_END --> |