From a69af36450701c12325575de175a84dec4aa45f4 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Tue, 5 Sep 2023 10:08:54 +0200 Subject: [PATCH] fix(neon): make AccountsBloc.activeAccount distinct Signed-off-by: Nikolas Rimikis --- packages/neon/neon/lib/src/blocs/accounts.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/neon/neon/lib/src/blocs/accounts.dart b/packages/neon/neon/lib/src/blocs/accounts.dart index a8ad92b1..2bbf0331 100644 --- a/packages/neon/neon/lib/src/blocs/accounts.dart +++ b/packages/neon/neon/lib/src/blocs/accounts.dart @@ -124,8 +124,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState BehaviorSubject> accounts = BehaviorSubject>.seeded([]); @override - BehaviorSubject activeAccount = BehaviorSubject() - ..distinct((final current, final next) => current?.id != next?.id); + BehaviorSubject activeAccount = BehaviorSubject(); @override void addAccount(final Account account) { @@ -161,7 +160,9 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState @override void setActiveAccount(final Account account) { - activeAccount.add(account); + if (activeAccount.valueOrNull != account) { + activeAccount.add(account); + } } @override