feat: support async app template (#1626)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
co-authored by
Asher Gomez
parent
563b61d849
commit
ba67d895ce
@@ -1,15 +1,15 @@
|
||||
import { LayoutProps, RouteContext } from "$fresh/server.ts";
|
||||
import { LayoutContext } from "$fresh/server.ts";
|
||||
import { delay } from "$fresh/tests/deps.ts";
|
||||
|
||||
export default async function AsyncLayout(
|
||||
req: Request,
|
||||
ctx: RouteContext,
|
||||
{ Component }: LayoutProps,
|
||||
ctx: LayoutContext,
|
||||
) {
|
||||
await new Promise((r) => setTimeout(r, 10));
|
||||
await delay(10);
|
||||
return (
|
||||
<div class="async-layout">
|
||||
<p>Async layout</p>
|
||||
<Component />
|
||||
<ctx.Component />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { LayoutProps, RouteContext } from "$fresh/server.ts";
|
||||
import { LayoutContext } from "$fresh/server.ts";
|
||||
import { delay } from "$std/async/mod.ts";
|
||||
|
||||
export default async function AsyncSubLayout(
|
||||
req: Request,
|
||||
ctx: RouteContext,
|
||||
{ Component }: LayoutProps,
|
||||
ctx: LayoutContext,
|
||||
) {
|
||||
await delay(10);
|
||||
return new Response(null, {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { LayoutProps, RouteContext } from "$fresh/server.ts";
|
||||
import { LayoutContext } from "$fresh/server.ts";
|
||||
|
||||
export default async function AsyncSubLayout(
|
||||
req: Request,
|
||||
ctx: RouteContext,
|
||||
{ Component }: LayoutProps,
|
||||
ctx: LayoutContext,
|
||||
) {
|
||||
await new Promise((r) => setTimeout(r, 10));
|
||||
return (
|
||||
<div class="async-sub-layout">
|
||||
<p>Async Sub layout</p>
|
||||
<Component />
|
||||
<ctx.Component />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user