diff --git a/lib/bloc/domain_search/domain_search_bloc.dart b/lib/bloc/domain_search/domain_search_bloc.dart index 91f607c..f05797e 100644 --- a/lib/bloc/domain_search/domain_search_bloc.dart +++ b/lib/bloc/domain_search/domain_search_bloc.dart @@ -23,17 +23,28 @@ class DomainSearchBloc extends Bloc { // Listen for events in domains globalEventsSink.domainTransfers.listen((event) { debugPrint('[DomainSearchBloc] transfer event received: $event'); - debugPrint( - '[DomainSearchBloc] last searched domain: ${_getLastSearchedDomain()}'); - debugPrint('[DomainSearchBloc] event domain: ${event.domainName}'); + _onReloadDomain(event.domainName); + }); - if (_getLastSearchedDomain() == event.domainName) { - // Reload the domain - search(event.domainName); - } + // Listen for events in domain edits + globalEventsSink.domainEdits.listen((event) { + debugPrint('[DomainSearchBloc] edit event received: $event'); + _onReloadDomain(event.domainName); }); } + void _onReloadDomain(String domainName) { + debugPrint( + '[DomainSearchBloc] last searched domain: ${_getLastSearchedDomain()}', + ); + debugPrint('[DomainSearchBloc] event domain: $domainName'); + + if (_getLastSearchedDomain() == domainName) { + // Reload the domain + search(domainName); + } + } + void search(String domain) => add(DomainSearchEventSearch(domain)); void clear() => add(const DomainSearchEventClear());