fix: useLume must be in Browser component and passed to boot
This commit is contained in:
parent
50f868135e
commit
72737d9657
|
@ -21,7 +21,7 @@ import Arrow from "@/components/Arrow.tsx";
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
import { Input } from "@/components/ui/input.tsx";
|
import { Input } from "@/components/ui/input.tsx";
|
||||||
import { Button } from "@/components/ui/button.tsx";
|
import { Button } from "@/components/ui/button.tsx";
|
||||||
import { useLume } from "@lumeweb/sdk";
|
import { type LumeContextType, useLume } from "@lumeweb/sdk";
|
||||||
|
|
||||||
let BOOT_FUNCTIONS: (() => Promise<any>)[] = [];
|
let BOOT_FUNCTIONS: (() => Promise<any>)[] = [];
|
||||||
|
|
||||||
|
@ -58,9 +58,7 @@ export function useBrowserState() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function boot() {
|
async function boot(lume: LumeContextType) {
|
||||||
const lume = useLume();
|
|
||||||
|
|
||||||
const reg = await navigator.serviceWorker.register("/sw.js");
|
const reg = await navigator.serviceWorker.register("/sw.js");
|
||||||
await reg.update();
|
await reg.update();
|
||||||
|
|
||||||
|
@ -167,9 +165,10 @@ export function Navigator() {
|
||||||
|
|
||||||
export function Browser() {
|
export function Browser() {
|
||||||
const { url } = useBrowserState();
|
const { url } = useBrowserState();
|
||||||
|
const lume = useLume();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
boot();
|
boot(lume);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <iframe src={url} className="w-full h-full"></iframe>;
|
return <iframe src={url} className="w-full h-full"></iframe>;
|
||||||
|
|
Loading…
Reference in New Issue