Skip to content

Commit

Permalink
Fix instance explorer paging issue (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo authored Mar 12, 2024
1 parent 5e61e18 commit b92cecc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/instance/pages/instance_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class InstancePage extends StatefulWidget {

class _InstancePageState extends State<InstancePage> {
final ScrollController _scrollController = ScrollController(initialScrollOffset: 0);
bool _isLoading = false;

bool? isBlocked;
bool currentlyTogglingBlock = false;
Expand Down Expand Up @@ -352,11 +353,13 @@ class _InstancePageState extends State<InstancePage> {
}

Future<void> _onScroll() async {
if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent * 0.8) {
if (!_isLoading && _scrollController.position.pixels >= _scrollController.position.maxScrollExtent * 0.8) {
_isLoading = true;
InstancePageState? instancePageState = buildContext?.read<InstancePageCubit>().state;
if (instancePageState != null && instancePageState.status != InstancePageStatus.done) {
await _doLoad(buildContext!, page: (instancePageState.page ?? 0) + 1);
}
_isLoading = false;
}
}
}

0 comments on commit b92cecc

Please sign in to comment.