-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rendering): prevent removal of necessary <astro-slot>
elements
#10317
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f54742c
fix(rendering): prevent removal of necessary `<astro-slot>` elements
lilnasy 338d950
add test
lilnasy c107600
add changeset
lilnasy af2a503
missed a spot
lilnasy aedcf92
adjust test
lilnasy d2e1e2a
assume `supportsAstroStaticSlot`
lilnasy 1ff765a
bring back accidentally removed `markHTMLString` call
lilnasy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fixes an issue where elements slotted within interactive framework components disappeared after hydration. |
6 changes: 6 additions & 0 deletions
6
packages/astro/e2e/fixtures/svelte-component/src/components/Poly.astro
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,6 @@ | ||
--- | ||
const Tag = 'div'; | ||
--- | ||
<Tag> | ||
<slot /> | ||
</Tag> |
4 changes: 4 additions & 0 deletions
4
packages/astro/e2e/fixtures/svelte-component/src/components/Stuff.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,4 @@ | ||
<script> | ||
export let id; | ||
</script> | ||
<div {id}>Slot goes here:<slot /></div> |
23 changes: 23 additions & 0 deletions
23
packages/astro/e2e/fixtures/svelte-component/src/pages/with-slots.astro
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,23 @@ | ||
--- | ||
import Poly from '../components/Poly.astro'; | ||
import Stuff from '../components/Stuff.svelte'; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
<h1>Astro</h1> | ||
|
||
<Poly> | ||
<Stuff client:load id="hydratable">poo</Stuff> | ||
</Poly> | ||
|
||
<Poly> | ||
<Stuff id="ssr-only">bar</Stuff> | ||
</Poly> | ||
</body> | ||
</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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,9 @@ describe('Slots with client: directives', () => { | |
assert.equal($('script').length, 1); | ||
}); | ||
|
||
it('Astro slot tags are cleaned', async () => { | ||
it('Astro slot tags are kept', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const $ = cheerio.load(html); | ||
assert.equal($('astro-slot').length, 0); | ||
assert.equal($('astro-slot').length, 1); | ||
}); | ||
Comment on lines
-21
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test was checking for the conditions that cause the bug. We need |
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"parent of a parent" -> "grandparent"?