From 72737d96578b806388ba5c2e917a5cf798099889 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 12 Oct 2023 13:06:48 -0400 Subject: [PATCH] fix: useLume must be in Browser component and passed to boot --- src/components/Browser.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Browser.tsx b/src/components/Browser.tsx index bed7444..427c9ae 100644 --- a/src/components/Browser.tsx +++ b/src/components/Browser.tsx @@ -21,7 +21,7 @@ import Arrow from "@/components/Arrow.tsx"; import type React from "react"; import { Input } from "@/components/ui/input.tsx"; import { Button } from "@/components/ui/button.tsx"; -import { useLume } from "@lumeweb/sdk"; +import { type LumeContextType, useLume } from "@lumeweb/sdk"; let BOOT_FUNCTIONS: (() => Promise)[] = []; @@ -58,9 +58,7 @@ export function useBrowserState() { return context; } -async function boot() { - const lume = useLume(); - +async function boot(lume: LumeContextType) { const reg = await navigator.serviceWorker.register("/sw.js"); await reg.update(); @@ -167,9 +165,10 @@ export function Navigator() { export function Browser() { const { url } = useBrowserState(); + const lume = useLume(); useEffect(() => { - boot(); + boot(lume); }, []); return ;