Skip to content

Commit abc65a2

Browse files
committed
store [nfc]: Take account ID for _reloadPerAccount
Now that the caller is getting the Account object by looking it up on the GlobalStore anyway, there's no checking to be gained from passing the whole Account here.
1 parent 6765527 commit abc65a2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/model/store.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ abstract class GlobalStore extends ChangeNotifier {
119119
return store;
120120
}
121121

122-
Future<void> _reloadPerAccount(Account account) async {
123-
assert(identical(_accounts[account.id], account));
124-
assert(_perAccountStores.containsKey(account.id));
125-
assert(!_perAccountStoresLoading.containsKey(account.id));
126-
final store = await loadPerAccount(account.id);
127-
_setPerAccount(account.id, store);
122+
Future<void> _reloadPerAccount(int accountId) async {
123+
assert(_perAccountStores.containsKey(accountId));
124+
assert(!_perAccountStoresLoading.containsKey(accountId));
125+
final store = await loadPerAccount(accountId);
126+
_setPerAccount(accountId, store);
128127
}
129128

130129
void _setPerAccount(int accountId, PerAccountStore store) {
@@ -672,7 +671,7 @@ class UpdateMachine {
672671
switch (e) {
673672
case ZulipApiException(code: 'BAD_EVENT_QUEUE_ID'):
674673
assert(debugLog('Lost event queue for $store. Replacing…'));
675-
await store._globalStore._reloadPerAccount(store.account);
674+
await store._globalStore._reloadPerAccount(store.accountId);
676675
dispose();
677676
debugLog('… Event queue replaced.');
678677
return;

0 commit comments

Comments
 (0)