Skip to content

Commit f7c7c68

Browse files
committed
fix(content_management): respect forceRefresh flag when fetching content
- Add check for forceRefresh flag in headlines, topics, and sources fetch logic - Prevent redundant API calls when forceRefresh is false and data is already available
1 parent d448e14 commit f7c7c68

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/content_management/bloc/content_management_bloc.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ class ContentManagementBloc
9898
// do not re-fetch. This prevents redundant API calls on tab changes.
9999
if (state.headlinesStatus == ContentManagementStatus.success &&
100100
state.headlines.isNotEmpty &&
101-
event.startAfterId == null) {
101+
event.startAfterId == null &&
102+
!event.forceRefresh) {
102103
return;
103104
}
104105

@@ -187,7 +188,8 @@ class ContentManagementBloc
187188
// do not re-fetch. This prevents redundant API calls on tab changes.
188189
if (state.topicsStatus == ContentManagementStatus.success &&
189190
state.topics.isNotEmpty &&
190-
event.startAfterId == null) {
191+
event.startAfterId == null &&
192+
!event.forceRefresh) {
191193
return;
192194
}
193195

@@ -276,7 +278,8 @@ class ContentManagementBloc
276278
// do not re-fetch. This prevents redundant API calls on tab changes.
277279
if (state.sourcesStatus == ContentManagementStatus.success &&
278280
state.sources.isNotEmpty &&
279-
event.startAfterId == null) {
281+
event.startAfterId == null &&
282+
!event.forceRefresh) {
280283
return;
281284
}
282285

0 commit comments

Comments
 (0)