Skip to content

Commit ba9507a

Browse files
committed
refactor(headlines-feed): remove initial capsule filter logic
Remove the use of initialSelectedCountryIsoCodes and initialSelectedSourceTypes from the SourcesFilterBloc. These values were not being used correctly, as the initial country and source type capsule selections are only ephemeral to the UI of the SourceFilterPage and are not passed via the event. Instead, they are now initialized as empty sets, meaning the filter starts with all countries and source types selected by default in the UI.
1 parent 058f0a5 commit ba9507a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/headlines-feed/bloc/sources_filter_bloc.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,17 @@ class SourcesFilterBloc extends Bloc<SourcesFilterEvent, SourcesFilterState> {
4242
.map((s) => s.id)
4343
.toSet();
4444

45-
// Use the passed-in initial capsule selections directly
46-
final initialSelectedCountryIsoCodes =
47-
event.initialSelectedCountryIsoCodes;
48-
final initialSelectedSourceTypes = event.initialSelectedSourceTypes;
45+
// The initial country and source type capsule selections are ephemeral
46+
// to the UI of the SourceFilterPage and are not passed via the event.
47+
// They are initialized as empty sets here, meaning the filter starts
48+
// with all countries and source types selected by default in the UI.
49+
final initialSelectedCountryIsoCodes = <String>{};
50+
final initialSelectedSourceTypes = <SourceType>{};
4951

5052
final allAvailableSources = (await _sourcesRepository.readAll()).items;
5153

5254
// Initially, display all sources. Capsules are visually set but don't filter the list yet.
5355
// Filtering will occur if a capsule is manually toggled.
54-
// However, if initial capsule filters ARE provided, we should respect them for the initial display.
5556
final displayableSources = _getFilteredSources(
5657
allSources: allAvailableSources,
5758
selectedCountries: initialSelectedCountryIsoCodes,

0 commit comments

Comments
 (0)