fix: prevent loadKernel from running twice

This commit is contained in:
Derrick Hammer 2023-09-11 05:56:03 -04:00
parent 341e5ef128
commit 1329712573
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,8 @@ import { getStoredUserKey } from "./storage.js";
import { readableStreamToBlob } from "binconv";
import { addContextToErr } from "@lumeweb/libkernel";
let kernelLoadAttempt = false;
export function boot() {
let userKey;
@ -37,6 +39,12 @@ export function boot() {
}
export async function loadKernel() {
if (kernelLoadAttempt) {
return;
}
kernelLoadAttempt = true;
try {
maybeInitDefaultPortals();
} catch (e) {