Browse Source

fix(neon): make AccountsBloc.activeAccount distinct

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/713/head
Nikolas Rimikis 1 year ago
parent
commit
a69af36450
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 7
      packages/neon/neon/lib/src/blocs/accounts.dart

7
packages/neon/neon/lib/src/blocs/accounts.dart

@ -124,8 +124,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]); BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]);
@override @override
BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>() BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>();
..distinct((final current, final next) => current?.id != next?.id);
@override @override
void addAccount(final Account account) { void addAccount(final Account account) {
@ -161,7 +160,9 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
@override @override
void setActiveAccount(final Account account) { void setActiveAccount(final Account account) {
activeAccount.add(account); if (activeAccount.valueOrNull != account) {
activeAccount.add(account);
}
} }
@override @override

Loading…
Cancel
Save