Add Partials (#1824)

This commit is contained in:
Marvin Hagemeister
2023-09-27 13:34:30 +02:00
committed by GitHub
parent d9829e25e6
commit 665d35bbc2
92 changed files with 3271 additions and 116 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
import { type ComponentChildren, type VNode } from "preact";
import { Island } from "../types.ts";
import { ContentSecurityPolicy } from "../../runtime/csp.ts";
import { PARTIAL_SEARCH_PARAM } from "../../constants.ts";
export interface RenderStateRouteOptions {
url: URL;
@@ -36,8 +37,9 @@ export class RenderState {
ownerStack: VNode[] = [];
owners = new Map<VNode, VNode>();
#nonce = "";
islandCounter = 0;
error: Error | null = null;
isPartial: boolean;
partialCount = 0;
constructor(
routeOptions: RenderStateRouteOptions,
@@ -49,6 +51,7 @@ export class RenderState {
this.routeOptions = routeOptions;
this.csp = csp;
this.componentStack = componentStack;
this.isPartial = routeOptions.url.searchParams.has(PARTIAL_SEARCH_PARAM);
if (error) this.routeOptions.error = error;
}