fix: repair wallet state on delete (closes #156) #194

Merged
clawbot merged 1 commits from fix/issue-156-delete-last-wallet into next 2026-08-11 14:23:07 +02:00

1 Commits

Author SHA1 Message Date
bcaf0cb1f5 fix: repair wallet state on delete (closes #156)
All checks were successful
check / check (push) Successful in 30s
Deleting a wallet left three defects in the same path:

- `hasWallet` stayed true after the last wallet was deleted, so the next
  popup open rendered Home with "No wallets yet" instead of Welcome. It
  now tracks whether any wallet remains.
- The selection was reset to wallet 0 / address 0 unconditionally.
  `selectedWallet` now follows the splice (decremented when a wallet
  before it is removed), and only falls back to the first remaining
  wallet's first address when the selection itself was deleted;
  `activeAddress` only moves when it belonged to the deleted wallet.
- No `AUTISTMASK_ACTIVE_CHANGED` was sent, so connected sites kept
  reporting a deleted address. The delete path now broadcasts it after
  the state is persisted, whenever the active address actually changed,
  and the background re-emits `accountsChanged` from there.

The transition moved into `src/shared/walletDelete.js` so it can be
tested without a DOM. Site-permission cleanup is unchanged and still
covers every address of an HD wallet.
2026-08-11 12:17:17 +00:00