diff --git a/public/assets/wallet.js b/public/assets/wallet.js
index 9b06470..257120c 100644
--- a/public/assets/wallet.js
+++ b/public/assets/wallet.js
@@ -80,7 +80,13 @@ window.IAPWallet = (function () {
const c = await IAP.getConfig();
await initAppKit(c);
let addr = currentAddress();
+ if (!addr) {
+ // give AppKit a moment to rehydrate an existing session before popping the
+ // picker — otherwise an already-connected wallet still gets the modal
+ for (let i = 0; i < 8 && !addr; i++) { await new Promise(r => setTimeout(r, 150)); addr = currentAddress(); }
+ }
if (!addr) { try { await modal.open(); } catch (e) {} addr = await waitForConnection(180000); }
+ try { if (modal && modal.close) await modal.close(); } catch (e) {} // dismiss the picker once we're connected
provider = await resolveProvider();
await ensureChain(c).catch(() => {}); // AppKit already connects on the right network; switch is best-effort
return addr;
diff --git a/public/index.html b/public/index.html
index a90e407..09d2cd7 100644
--- a/public/index.html
+++ b/public/index.html
@@ -439,7 +439,7 @@
-
+