Skip to content

Commit ca1d840

Browse files
committed
fix(feed): fix initial load and scroll loading
- Fixed initial load on page init - Fixed scroll load condition
1 parent d837db2 commit ca1d840

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
3434
void initState() {
3535
super.initState();
3636
_scrollController.addListener(_onScroll);
37-
context.read<HeadlinesFeedBloc>().add(HeadlinesFeedRefreshRequested());
37+
// context.read<HeadlinesFeedBloc>().add(HeadlinesFeedRefreshRequested());
3838
}
3939

4040
@override
@@ -46,9 +46,9 @@ class _HeadlinesFeedViewState extends State<_HeadlinesFeedView> {
4646
}
4747

4848
void _onScroll() {
49-
if (_isBottom) {
50-
final state = context.read<HeadlinesFeedBloc>().state;
51-
if (state is HeadlinesFeedLoaded) {
49+
final state = context.read<HeadlinesFeedBloc>().state;
50+
if (_isBottom && state is HeadlinesFeedLoaded) {
51+
if (state.hasMore) {
5252
context
5353
.read<HeadlinesFeedBloc>()
5454
.add(const HeadlinesFeedFetchRequested());

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ packages:
251251
description:
252252
path: "."
253253
ref: main
254-
resolved-ref: eaf98cb0379c1661f3137b88121b79630bf11069
254+
resolved-ref: "1129f48c9af0b3b297e8f6717d88363b3d166890"
255255
url: "https://github.com/headlines-toolkit/ht-headlines-inmemory.git"
256256
source: git
257257
version: "0.0.0"

0 commit comments

Comments
 (0)