Conversation
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Preview deployment ✅ Deployment complete!
|
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thanks, Ema! Except the API block that contains a few issues, my other suggestions are mostly nit. I also left a question about <script /> tags behavior.
| **Type:** <code>(component: AstroComponentFactory; options?: <a href="#rendering-options">ContainerRenderOptions</a>) => Promise<Response></code> | ||
| </p> | ||
| <p><Since v="7.3.4" /></p> |
There was a problem hiding this comment.
- consistency: We want them in the same block, not two paragraphs
- This seems to return
Promise<string>and notPromise<Response>, which makes more sense if it returns HTML - It doesn't seem to accept
routeTypeas option
| **Type:** <code>(component: AstroComponentFactory; options?: <a href="#rendering-options">ContainerRenderOptions</a>) => Promise<Response></code> | |
| </p> | |
| <p><Since v="7.3.4" /></p> | |
| **Type:** <code>(component: AstroComponentFactory; options?: Omit\<<a href="#rendering-options">ContainerRenderOptions</a>, 'routeType'\>) => Promise<string></code><br /> | |
| <Since v="7.3.4" /> | |
| </p> |
| </p> | ||
| <p><Since v="7.3.4" /></p> | ||
|
|
||
| It renders a component, and returns its HTML with script and styles. The Astro component must be imported with the query string `?container`. |
There was a problem hiding this comment.
nit: we usually try to avoid restating what the function name already says (ie. "renderComponent(): it renders a component"), but it's tricky when the function name is well chosen... And, I can see some other methods on the page already use similar wording, so not blocking.
But if we want to update that, maybe something like the following could work:
| It renders a component, and returns its HTML with script and styles. The Astro component must be imported with the query string `?container`. | |
| A function that returns the HTML for a component, including its scripts and styles. It takes an Astro component imported with the `?container` query string as an argument. |
|
|
||
| It renders a component, and returns its HTML with script and styles. The Astro component must be imported with the query string `?container`. | ||
|
|
||
| The container will only render the styles declared in the `<style>` element, and the scripts declared in the `<script>` element. Assets imported via `import` are not rendered. |
There was a problem hiding this comment.
Question: does it works <script src="./any-script.ts"></script> (does the path is resolved/transpiled?) or is it considered the same as import statements?
|
|
||
| ``` | ||
|
|
||
| Omitting the `?container` query string will result in the same output as [`renderToString()`](#rendertostring) |
There was a problem hiding this comment.
nit: missing period
| Omitting the `?container` query string will result in the same output as [`renderToString()`](#rendertostring) | |
| Omitting the `?container` query string will result in the same output as [`renderToString()`](#rendertostring). |
Description (required)
It documents a new
renderComponentfunction in the Astro container APIsReferences
Ref withastro/astro#17736