Open rorystephenson opened 9 months ago
I can reproduce the issue using the plugin example code. It seems like this is working as designed (at least from the source code). The current implementation only accounts for snapshot.isFetching
(which seems to be for the initial loading) but not for isFetchingMore
which would cater to showing a loading indicator when more data is being fetched.
Perhaps we can treat this as a feature request. Labeling for further insight from the team.
cc @lesnitsky
I can reproduce the issue using the plugin example code. It seems like this is working as designed (at least from the source code). The current implementation only accounts for
snapshot.isFetching
(which seems to be for the initial loading) but not forisFetchingMore
which would cater to showing a loading indicator when more data is being fetched.Perhaps we can treat this as a feature request. Labeling for further insight from the team.
cc @lesnitsky
That makes sense from a code-correctness point of view. From a UX point of view I think it is a bit confusing, when you hit the bottom it stops scrolling and unless you know that more data is being loaded you may not try to drag again once new data has loaded.
Aside from that I was not able to achieve a loading indicator effect when fetching more pages using FirestoreQueryBuilder, isFetchingMore
never seemed to be true.
@rorystephenson You need to manually trigger the "fetch next page"
The loading handling of FirestoreListView is limited. There are numerous competing UX standards here, and it cannot really handle them all. The recommended solution is that when you have a case not handled by the default list view, you should switch to the query builder variant and do it yourself.
So there's no bug from a specs point of view. It's more about a feature request.
@rorystephenson You need to manually trigger the "fetch next page"
The loading handling of FirestoreListView is limited. There are numerous competing UX standards here, and it cannot really handle them all. The recommended solution is that when you have a case not handled by the default list view, you should switch to the query builder variant and do it yourself.
So there's no bug from a specs point of view. It's more about a feature request.
@rrousselGit Yep trying to support all the possible UX standards would be a mess. I am already using FirestoreQueryBuilder in my own project because when I used the plain FirestoreListView it triggered too much loading at the start (that's off-topic and there is another issue which seems to be tackling this). I had tried adding a loading indicator but it wasn't showing up, now that I've revisited it I realise that it's not enough to depend on isFetchingMore
alone, you need to also show the loading indicator when hasMore
is true. I hacked together a working version based on the example app: https://github.com/rorystephenson/FirebaseUI-Flutter/commit/e9fd0ec2fd39b8a7a9f34468270a07f712b78513
You'll notice that I added a debugPrint to log the snapshot state during rebuilds. Once the initial pages have loaded, flicking to scroll leads to the following debugPrints (ignore the 'Showing loading indicator' lines, that just shows when the loading indicator is built):
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore false
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): Showing loading indicator
I/flutter (26367): isFetching false isFetchingMore false hasMore false
I/flutter (26367): isFetching false isFetchingMore false hasMore true
I/flutter (26367): isFetching false isFetchingMore true hasMore true
I/flutter (26367): isFetching false isFetchingMore false hasMore false
I/flutter (26367): isFetching false isFetchingMore false hasMore true
It seems to work well although given that it loads very fast it's hard to be sure if there is any flickering or not. I was surprised to see that hasMore
is sometimes false during the flicking, I would've expected it to always be true as there are more pages 🤷 .
In any case this seems to work, it could be worth adding to the example app or the documentation.
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Firestore
What platform(s) does this bug affect?
Android, iOS, Web, macOS, Linux, Windows
List of dependencies used.
flutter pub deps -s list
Steps to reproduce
pageSize
to a small number like 2 and add aloadingBuilder
with adebugPrint
statement and visible child like a redContainer
with 100 height.Example changes:
Expected Behavior
Actual Behavior
During the initial load the loading indicator shows correctly, when fetching subsequent pages it is never shown.
Additional Information
No response