Skip to content

Commit 80a32ed

Browse files
committed
docs(content_management): explain background fetching for countries
- Add detailed comments in both create_headline_bloc.dart and edit_headline_bloc.dart - Explain the reason for using background fetching for countries - Highlight UI consistency and technical limitations as motivations - Describe how the UI updates progressively in the background
1 parent 8a745ac commit 80a32ed

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/content_management/bloc/create_headline/create_headline_bloc.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,16 @@ class CreateHeadlineBloc
7676
),
7777
);
7878

79-
// Start background fetching for all countries
79+
// After the initial page of countries is loaded, start a background
80+
// process to fetch all remaining pages.
81+
//
82+
// This approach is used for the following reasons:
83+
// 1. UI Consistency: It allows us to use the standard
84+
// `DropdownButtonFormField`, which is used elsewhere in the app.
85+
// 2. Technical Limitation: The standard dropdown does not expose a
86+
//
87+
// The UI will update progressively and silently in the background as
88+
// more data arrives.
8089
while (state.countriesHasMore) {
8190
final nextCountries = await _countriesRepository.readAll(
8291
pagination: PaginationOptions(cursor: state.countriesCursor),

lib/content_management/bloc/edit_headline/edit_headline_bloc.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
8787
),
8888
);
8989

90-
// Start background fetching for all countries
90+
// After the initial page of countries is loaded, start a background
91+
// process to fetch all remaining pages.
92+
//
93+
// This approach is used for the following reasons:
94+
// 1. UI Consistency: It allows us to use the standard
95+
// `DropdownButtonFormField`, which is used elsewhere in the app.
96+
// 2. Technical Limitation: The standard dropdown does not expose a
97+
//
98+
// The UI will update progressively and silently in the background as
99+
// more data arrives.
91100
while (state.countriesHasMore) {
92101
final nextCountries = await _countriesRepository.readAll(
93102
pagination: PaginationOptions(cursor: state.countriesCursor),

0 commit comments

Comments
 (0)