feat: _app (#87)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Leo Kettmeir
2022-02-18 19:30:24 +01:00
committed by GitHub
co-authored by Luca Casonato
parent 2ec980ca45
commit 04a32f3498
8 changed files with 67 additions and 5 deletions
+7 -2
View File
@@ -3,7 +3,7 @@
import { renderToString } from "./deps.ts";
import { ComponentChildren, h } from "../runtime/deps.ts";
import { DATA_CONTEXT } from "../runtime/hooks.ts";
import { ErrorPage, Page, Renderer, UnknownPage } from "./types.ts";
import { AppModule, ErrorPage, Page, Renderer, UnknownPage } from "./types.ts";
import {
ErrorPageProps,
PageProps,
@@ -17,6 +17,7 @@ import { ContentSecurityPolicy } from "../runtime/csp.ts";
export interface RenderOptions {
page: Page | UnknownPage | ErrorPage;
app: AppModule;
imports: string[];
preloads: string[];
url: URL;
@@ -145,7 +146,11 @@ export async function* render(
value: dataCache,
children: h(SUSPENSE_CONTEXT.Provider, {
value: suspenseQueue,
children: h(opts.page.component!, props),
children: h(opts.app.default, {
Component() {
return h(opts.page.component!, props);
},
}),
}),
}),
}),