From ff973a772163676c9769cb84ec9208b600cbb2c4 Mon Sep 17 00:00:00 2001 From: Pierre Demailly Date: Sat, 7 Dec 2024 15:29:38 +0100 Subject: [PATCH] fix: init on reload when removed last active package only --- public/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/main.js b/public/main.js index 75957923..7bc2e375 100644 --- a/public/main.js +++ b/public/main.js @@ -64,7 +64,12 @@ document.addEventListener("DOMContentLoaded", async() => { } }); searchview.reset(); - await init(); + const nsnActivePackage = secureDataSet.linker.get(0); + const nsnRootPackage = `${nsnActivePackage.name}@${nsnActivePackage.version}`; + if (data.status === "RELOAD" && nsnRootPackage !== window.activePackage) { + // it means we removed the previous active package, which is still active in network, so we need to re-init + await init(); + } } else if (data.status === "SCAN") { searchview.onScan(data.pkg);