fix: loadState reads hasWallet from storage without reconciling it against wallets.length #195
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
loadState()insrc/shared/state.jstakeshasWalletstraight from storage and never checks it againstwallets.length.Consequence: any profile already saved in an inconsistent state stays broken after the fix in #156 — the extension keeps believing a wallet exists, and only a subsequent add or delete repairs it. That is every user who deleted their last wallet on a build predating that fix. The fix there corrects the write path; this is the read path.
Found while implementing #156 and deliberately left out of its scope.
Implementation requirements
loadState()must derivehasWalletfromwallets.lengthrather than trusting the persisted value, or reconcile and persist the correction on load.hasWalletdiffering fromwallets.lengthlegitimately, that must be established first rather than assumed.Definition of done
hasWallet: trueand zero wallets loads as having no wallet, and the popup lands on the welcome screen.hasWallet: falseand one or more wallets loads as having a wallet.TODO.mdupdated in the same commit.make checkpasses.