summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <ematipico@users.noreply.github.com> 2024-05-24 13:42:47 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-05-24 13:42:47 +0000
commit5af99dc8f1a144f3a2fdf254e25c42e83c7646dd (patch)
tree5f12d6b7387e92b7f116dcb64749cb13db08ed59
parent98e0372cfd47a3e025be2ac68d1e9ebf06cf548b (diff)
downloadastro-5af99dc8f1a144f3a2fdf254e25c42e83c7646dd.tar.gz
astro-5af99dc8f1a144f3a2fdf254e25c42e83c7646dd.tar.zst
astro-5af99dc8f1a144f3a2fdf254e25c42e83c7646dd.zip
[ci] format
-rw-r--r--packages/astro/src/container/index.ts7
-rw-r--r--packages/astro/src/core/render-context.ts22
-rw-r--r--packages/astro/test/container.test.js5
3 files changed, 19 insertions, 15 deletions
diff --git a/packages/astro/src/container/index.ts b/packages/astro/src/container/index.ts
index 824bc96a4..724c426f3 100644
--- a/packages/astro/src/container/index.ts
+++ b/packages/astro/src/container/index.ts
@@ -3,7 +3,8 @@ import type {
AstroRenderer,
AstroUserConfig,
ComponentInstance,
- MiddlewareHandler, Props,
+ MiddlewareHandler,
+ Props,
RouteData,
RouteType,
SSRLoadedRenderer,
@@ -73,12 +74,12 @@ export type ContainerRenderOptions = {
/**
* Allows to pass `Astro.props` to an Astro component:
- *
+ *
* ```js
* container.renderToString(Endpoint, { props: { "lorem": "ipsum" } });
* ```
*/
- props?: Props
+ props?: Props;
};
function createManifest(
diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts
index 307a3f240..32a3865db 100644
--- a/packages/astro/src/core/render-context.ts
+++ b/packages/astro/src/core/render-context.ts
@@ -3,7 +3,8 @@ import type {
AstroGlobal,
AstroGlobalPartial,
ComponentInstance,
- MiddlewareHandler, Props,
+ MiddlewareHandler,
+ Props,
RewritePayload,
RouteData,
SSRResult,
@@ -98,14 +99,17 @@ export class RenderContext {
): Promise<Response> {
const { cookies, middleware, pathname, pipeline } = this;
const { logger, routeCache, serverLike, streaming } = pipeline;
- const props = Object.keys(this.props).length > 0 ? this.props : await getProps({
- mod: componentInstance,
- routeData: this.routeData,
- routeCache,
- pathname,
- logger,
- serverLike,
- });
+ const props =
+ Object.keys(this.props).length > 0
+ ? this.props
+ : await getProps({
+ mod: componentInstance,
+ routeData: this.routeData,
+ routeCache,
+ pathname,
+ logger,
+ serverLike,
+ });
const apiContext = this.createAPIContext(props);
this.counter++;
diff --git a/packages/astro/test/container.test.js b/packages/astro/test/container.test.js
index 6704aa03f..c8b29a22a 100644
--- a/packages/astro/test/container.test.js
+++ b/packages/astro/test/container.test.js
@@ -140,7 +140,6 @@ describe('Container', () => {
assert.match(result, /Bar name/);
});
-
it('Renders props', async () => {
const Page = createComponent(
(result, props, _slots) => {
@@ -152,7 +151,7 @@ describe('Container', () => {
{
default: () => render`
${maybeRenderHead(result)}
- ${props.isOpen ? "Is open" : "Is closed"}
+ ${props.isOpen ? 'Is open' : 'Is closed'}
`,
head: () => render`
${renderComponent(
@@ -175,7 +174,7 @@ describe('Container', () => {
const container = await experimental_AstroContainer.create();
const result = await container.renderToString(Page, {
props: {
- isOpen: true
+ isOpen: true,
},
});