Make wallet disconnect not hang
AppKit's modal.disconnect() can stall on the WalletConnect relay (mobile),
leaving the Disconnect button spinning forever ("just loads and says
disconnect") and never reaching the reload. Race the disconnect against a
1.2s timeout, and fire-and-forget from the button with a guaranteed reload
that drops in-memory wallet state so the picker returns.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+6
-5
@@ -1429,11 +1429,12 @@
|
||||
IAP.status('Faucet opened in a new tab. Choose Polygon Amoy, paste your address, and request test POL.', 'ok');
|
||||
}));
|
||||
if ($('wcDisconnect')) $('wcDisconnect').addEventListener('click', busy($('wcDisconnect'), async () => {
|
||||
try { await IAPWallet.disconnect(); } catch (e) {}
|
||||
$('wcDisconnectInfo').textContent = 'Disconnected. Reloading so you can pick a different wallet…';
|
||||
IAP.status('Wallet disconnected. Reloading…', 'ok');
|
||||
// reload to drop any in-memory WalletConnect state so the picker reappears
|
||||
setTimeout(() => location.reload(), 700);
|
||||
// fire-and-forget: don't gate the reload on disconnect resolving (it can
|
||||
// stall). The reload drops all in-memory wallet state and the picker returns.
|
||||
IAPWallet.disconnect().catch(() => {});
|
||||
$('wcDisconnectInfo').textContent = 'Disconnecting — reloading so you can pick a different wallet…';
|
||||
IAP.status('Disconnecting — reloading…', 'ok');
|
||||
setTimeout(() => location.reload(), 900);
|
||||
}));
|
||||
$('activateBtn').addEventListener('click', busy($('activateBtn'), async () => {
|
||||
const me = await (await fetch('/api/me')).json();
|
||||
|
||||
Reference in New Issue
Block a user