summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/context
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/context')
-rw-r--r--packages/ui/src/context/helper.tsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/ui/src/context/helper.tsx b/packages/ui/src/context/helper.tsx
index 6be88e775..53f987945 100644
--- a/packages/ui/src/context/helper.tsx
+++ b/packages/ui/src/context/helper.tsx
@@ -1,4 +1,4 @@
-import { createContext, Show, useContext, type ParentProps } from "solid-js"
+import { createContext, createMemo, Show, useContext, type ParentProps, type Accessor } from "solid-js"
export function createSimpleContext<T, Props extends Record<string, any>>(input: {
name: string
@@ -9,9 +9,14 @@ export function createSimpleContext<T, Props extends Record<string, any>>(input:
return {
provider: (props: ParentProps<Props>) => {
const init = input.init(props)
- return (
+ // Access init.ready inside the memo to make it reactive for getter properties
+ const isReady = createMemo(() => {
// @ts-expect-error
- <Show when={init.ready === undefined || init.ready === true}>
+ const ready = init.ready as Accessor<boolean> | boolean | undefined
+ return ready === undefined || (typeof ready === "function" ? ready() : ready)
+ })
+ return (
+ <Show when={isReady()}>
<ctx.Provider value={init}>{props.children}</ctx.Provider>
</Show>
)