feat: add error message for async components (#413)
This commit is contained in:
@@ -400,6 +400,16 @@ export class ServerContext {
|
|||||||
if (route.component === undefined) {
|
if (route.component === undefined) {
|
||||||
throw new Error("This page does not have a component to render.");
|
throw new Error("This page does not have a component to render.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof route.component === "function" &&
|
||||||
|
route.component.constructor.name === "AsyncFunction"
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"Async components are not supported. Fetch data inside of a route handler, as described in the docs: https://fresh.deno.dev/docs/getting-started/fetching-data",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const preloads: string[] = [];
|
const preloads: string[] = [];
|
||||||
const resp = await internalRender({
|
const resp = await internalRender({
|
||||||
route,
|
route,
|
||||||
|
|||||||
Reference in New Issue
Block a user