feat: support async layout functions (#1597)

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
Marvin Hagemeister
2023-08-08 14:15:02 +02:00
committed by GitHub
co-authored by Asher Gomez
parent 11077227b5
commit 8325225a0d
11 changed files with 277 additions and 65 deletions
+7 -1
View File
@@ -176,9 +176,15 @@ export interface LayoutProps<T = any, S = Record<string, unknown>>
extends PageProps<T, S> {
Component: ComponentType<Record<never, never>>;
}
// deno-lint-ignore no-explicit-any
export type AsyncLayout<T = any, S = Record<string, unknown>> = (
req: Request,
ctx: RouteContext<T, S>,
props: LayoutProps,
) => Promise<ComponentChildren | Response>;
export interface LayoutModule {
default: ComponentType<LayoutProps>;
default: ComponentType<LayoutProps> | AsyncLayout;
}
export interface LayoutRoute {