0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

[ci] format

This commit is contained in:
Arsh 2024-03-18 14:00:35 +00:00 committed by astrobot-houston
parent fcece36586
commit 4c1edd0af5
5 changed files with 39 additions and 41 deletions

View file

@ -90,8 +90,10 @@ export class RenderContext {
const lastNext = async () => {
switch (routeData.type) {
case 'endpoint': return renderEndpoint(componentInstance as any, apiContext, serverLike, logger);
case 'redirect': return renderRedirect(this);
case 'endpoint':
return renderEndpoint(componentInstance as any, apiContext, serverLike, logger);
case 'redirect':
return renderRedirect(this);
case 'page': {
const result = await this.createResult(componentInstance!);
let response: Response;
@ -119,12 +121,10 @@ export class RenderContext {
return response;
}
case 'fallback': {
return (
new Response(null, { status: 500, headers: { [ROUTE_TYPE_HEADER]: 'fallback' } })
)
}
return new Response(null, { status: 500, headers: { [ROUTE_TYPE_HEADER]: 'fallback' } });
}
}
};
const response = await callMiddleware(middleware, apiContext, lastNext);
if (response.headers.get(ROUTE_TYPE_HEADER)) {

View file

@ -129,7 +129,7 @@ export async function renderToReadableStream(
// If the client disconnects,
// we signal to ignore the results of existing renders and avoid kicking off more of them.
result.cancelled = true;
}
},
});
}

View file

@ -459,13 +459,11 @@ export async function renderComponent(
slots: any = {}
): Promise<RenderInstance> {
if (isPromise(Component)) {
Component = await Component
.catch(handleCancellation);
Component = await Component.catch(handleCancellation);
}
if (isFragmentComponent(Component)) {
return await renderFragmentComponent(result, slots)
.catch(handleCancellation);
return await renderFragmentComponent(result, slots).catch(handleCancellation);
}
// Ensure directives (`class:list`) are processed
@ -473,16 +471,16 @@ export async function renderComponent(
// .html components
if (isHTMLComponent(Component)) {
return await renderHTMLComponent(result, Component, props, slots)
.catch(handleCancellation);
return await renderHTMLComponent(result, Component, props, slots).catch(handleCancellation);
}
if (isAstroComponentFactory(Component)) {
return renderAstroComponent(result, displayName, Component, props, slots);
}
return await renderFrameworkComponent(result, displayName, Component, props, slots)
.catch(handleCancellation);
return await renderFrameworkComponent(result, displayName, Component, props, slots).catch(
handleCancellation
);
function handleCancellation(e: unknown) {
if (result.cancelled) return { render() {} };