Skip to content

fix: I have addressed the bug where the headlines feed would get stuc… #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/headlines-feed/bloc/headlines_feed_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
/// Requires a [HtDataRepository<Headline>] to interact with the data layer.
HeadlinesFeedBloc({required HtDataRepository<Headline> headlinesRepository})
: _headlinesRepository = headlinesRepository,
super(HeadlinesFeedLoading()) {
super(HeadlinesFeedInitial()) {
on<HeadlinesFeedFetchRequested>(
_onHeadlinesFeedFetchRequested,
transformer:
Expand Down
5 changes: 5 additions & 0 deletions lib/headlines-feed/bloc/headlines_feed_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ sealed class HeadlinesFeedState extends Equatable {
List<Object?> get props => [];
}

/// {@template headlines_feed_initial}
/// The initial state of the headlines feed before any loading has begun.
/// {@endtemplate}
final class HeadlinesFeedInitial extends HeadlinesFeedState {}

/// {@template headlines_feed_loading}
/// State indicating that the headlines feed is currently being fetched,
/// typically shown with a full-screen loading indicator. This is used for
Expand Down
1 change: 1 addition & 0 deletions lib/headlines-feed/view/headlines_feed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
(previous, current) => current is! HeadlinesFeedLoadingSilently,
builder: (context, state) {
switch (state) {
case HeadlinesFeedInitial(): // Handle initial state
case HeadlinesFeedLoading():
// Display full-screen loading indicator
return LoadingStateWidget(
Expand Down
Loading