From f57e51858720209eb3a470f3d233da8216afc794 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Tue, 12 Mar 2024 14:16:50 -0300 Subject: [PATCH] Use maps instead of weakmaps Signed-off-by: Marcos Candeia --- runtime/fresh/middlewares/3_main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/fresh/middlewares/3_main.ts b/runtime/fresh/middlewares/3_main.ts index 3cd712f63..1f0a73e6f 100644 --- a/runtime/fresh/middlewares/3_main.ts +++ b/runtime/fresh/middlewares/3_main.ts @@ -1,4 +1,5 @@ import { MiddlewareHandlerContext } from "$fresh/server.ts"; +import { tryOrDefault } from "deco/utils/object.ts"; import { DECO_MATCHER_HEADER_QS } from "../../../blocks/matcher.ts"; import { RequestState } from "../../../blocks/utils.tsx"; import { Context } from "../../../deco.ts"; @@ -10,7 +11,6 @@ import { DecoSiteState, DecoState } from "../../../types.ts"; import { isAdminOrLocalhost } from "../../../utils/admin.ts"; import { allowCorsFor, defaultHeaders } from "../../../utils/http.ts"; import { formatLog } from "../../../utils/log.ts"; -import { tryOrDefault } from "deco/utils/object.ts"; export const DECO_SEGMENT = "deco_segment"; @@ -128,7 +128,7 @@ export const handler = [ status: undefined, }; const state: Partial = ctx.state?.$live?.state ?? {}; - const stateBag = new WeakMap(); + const stateBag = new Map(); state.response = response; state.bag = stateBag; state.flags = [];