feat: expose config in context + simplify page props (#2102)

This commit is contained in:
Marvin Hagemeister
2023-11-30 16:11:31 +01:00
committed by GitHub
parent aafe048243
commit 9e11c5c56b
11 changed files with 254 additions and 123 deletions
+5
View File
@@ -257,6 +257,7 @@ export class ServerContext {
const ctx: FreshContext = {
url,
params: {},
config: _self.#state.config,
basePath: _self.#state.config.basePath,
localAddr: connInfo.localAddr,
remoteAddr: connInfo.remoteAddr,
@@ -264,6 +265,7 @@ export class ServerContext {
isPartial: url.searchParams.has(PARTIAL_SEARCH_PARAM),
destination: "route",
error: undefined,
codeFrame: undefined,
Component: NOOP_COMPONENT,
next: NOOP_NEXT,
render: NOOP_NEXT,
@@ -272,6 +274,9 @@ export class ServerContext {
return await renderNotFound(req, ctx);
},
route: "",
get pattern() {
return ctx.route;
},
data: undefined,
};