0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00

[ci] format

This commit is contained in:
Emanuele Stoppa 2024-05-24 13:42:47 +00:00 committed by astrobot-houston
parent 98e0372cfd
commit 5af99dc8f1
3 changed files with 19 additions and 15 deletions

View file

@ -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(

View file

@ -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++;

View file

@ -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,
},
});