From 61c9873e0c3314245f54c024bde756ed2b665cc9 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:02:01 -0300 Subject: [PATCH] Update profile_name_bloc.dart --- lib/user/name/presentation/bloc/profile_name_bloc.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/user/name/presentation/bloc/profile_name_bloc.dart b/lib/user/name/presentation/bloc/profile_name_bloc.dart index 3683fcb0b..38b3ec272 100644 --- a/lib/user/name/presentation/bloc/profile_name_bloc.dart +++ b/lib/user/name/presentation/bloc/profile_name_bloc.dart @@ -44,6 +44,13 @@ class ProfileNameBloc extends Bloc { final primaryName = await _arnsRepository.getPrimaryName(walletAddress, update: refresh); + if (_auth.currentUser.walletAddress != walletAddress) { + // A user can load profile name and log out while fetching this request. Then log in again. We should not emit a profile name loaded state in this case. + logger.d('User logged out while fetching profile name'); + + return; + } + emit(ProfileNameLoaded(primaryName, walletAddress)); } catch (e) { if (e is PrimaryNameNotFoundException) {