Skip to content

Commit bf74fe2

Browse files
committed
backend: fix unknown account code error after removing device
This fixed unknown account code error described in last commit. The frontend got notified in wrong order when a device is removed. The keystore event was pushed before accounts have been removed, leading to a short moment when the frontend thinks it has accounts but no more keystore. Changed order so that the backend sends the keystore event after accounts are uninitialized.
1 parent fb06d5d commit bf74fe2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

backend/backend.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,16 +549,17 @@ func (backend *Backend) DeregisterKeystore() {
549549
fingerprint, _ := backend.keystore.RootFingerprint()
550550
backend.log.WithField("rootFingerprint", fingerprint).Info("deregistering keystore")
551551
backend.keystore = nil
552-
backend.Notify(observable.Event{
553-
Subject: "keystores",
554-
Action: action.Reload,
555-
})
556552

557553
backend.uninitAccounts()
558554
// TODO: classify accounts by keystore, remove only the ones belonging to the deregistered
559555
// keystore. For now we just remove all, then re-add the rest.
560556
backend.initPersistedAccounts()
561557
backend.emitAccountsStatusChanged()
558+
559+
backend.Notify(observable.Event{
560+
Subject: "keystores",
561+
Action: action.Reload,
562+
})
562563
}
563564

564565
// Register registers the given device at this backend.

0 commit comments

Comments
 (0)