mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-06 18:51:21 +02:00
fix: prevent wallet from auto-reconnecting after disconnect
The bug was in the useWallet hook which automatically restores the wallet if nwcConnection exists in state but the wallet instance is null. When disconnecting, it only cleared the wallet instance but left nwcConnection in state, causing an immediate reconnection. Fix: - Call disconnectNWCFromState() to clear nwcConnection from Grimoire state - Then call disconnect() to clear the wallet service - This prevents the auto-restore logic from triggering Now when you disconnect the wallet, it stays disconnected until you manually reconnect.
This commit is contained in:
@@ -185,7 +185,7 @@ function parseInvoice(invoice: string): InvoiceDetails | null {
|
||||
}
|
||||
|
||||
export default function WalletViewer() {
|
||||
const { state } = useGrimoire();
|
||||
const { state, disconnectNWC: disconnectNWCFromState } = useGrimoire();
|
||||
const {
|
||||
wallet,
|
||||
balance,
|
||||
@@ -616,6 +616,9 @@ export default function WalletViewer() {
|
||||
}
|
||||
|
||||
function handleDisconnect() {
|
||||
// Clear NWC connection from Grimoire state first
|
||||
disconnectNWCFromState();
|
||||
// Then clear the wallet service
|
||||
disconnect();
|
||||
setDisconnectDialogOpen(false);
|
||||
toast.success("Wallet disconnected");
|
||||
|
||||
Reference in New Issue
Block a user