-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass children to client components even if they do not render them (#…
…2588) * Pass children to client components even if they do not render them * Handle when no children are provided * Adds a changeset * Use roots directly i guess * Use an attribute to signal that the template is needed
- Loading branch information
Showing
12 changed files
with
149 additions
and
11 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 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix for passing children to client component when the component does not render them |
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
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
5 changes: 5 additions & 0 deletions
5
packages/astro/test/fixtures/astro-children/src/components/NoRender.jsx
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 @@ | ||
import { h } from 'preact'; | ||
|
||
export default function PreactComponent({ id, children, render = false }) { | ||
return <div id={id} class="preact-no-children">{render && children}</div>; | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/astro/test/fixtures/astro-children/src/pages/no-render.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,22 @@ | ||
--- | ||
import PreactComponent from '../components/NoRender.jsx'; | ||
--- | ||
<html> | ||
<head><title>Children</title></head> | ||
<body> | ||
<PreactComponent id="ssr-only"> | ||
<h1>Hello world</h1> | ||
<h1>Goodbye world</h1> | ||
</PreactComponent> | ||
<PreactComponent id="client" client:load> | ||
<h1>Hello world</h1> | ||
<h1>Goodbye world</h1> | ||
</PreactComponent> | ||
<PreactComponent id="client-render" render={true} client:load> | ||
<h1>Hello world</h1> | ||
<h1>Goodbye world</h1> | ||
</PreactComponent> | ||
|
||
<PreactComponent id="client-no-children" client:load></PreactComponent> | ||
</body> | ||
</html> |