From be9b2bab156d3eccaf1c8ea4fce2523407833fdd Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Thu, 8 Jan 2026 07:41:20 -0600 Subject: feat(app): cache session-scoped stores, optional context gating --- packages/ui/src/context/helper.tsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'packages/ui/src/context') diff --git a/packages/ui/src/context/helper.tsx b/packages/ui/src/context/helper.tsx index 53f987945..86684c876 100644 --- a/packages/ui/src/context/helper.tsx +++ b/packages/ui/src/context/helper.tsx @@ -3,12 +3,19 @@ import { createContext, createMemo, Show, useContext, type ParentProps, type Acc export function createSimpleContext>(input: { name: string init: ((input: Props) => T) | (() => T) + gate?: boolean }) { const ctx = createContext() return { provider: (props: ParentProps) => { const init = input.init(props) + const gate = input.gate ?? true + + if (!gate) { + return {props.children} + } + // Access init.ready inside the memo to make it reactive for getter properties const isReady = createMemo(() => { // @ts-expect-error -- cgit v1.2.3