Skip to content

Commit 2109f44

Browse files
committed
fix(shared): prevent loading more when reaching bottom while extracting
- Add a check for loading state before triggering onLoadMore() - Extract isLoadingExtractor from widget to avoid redundant calls - Improve performance and prevent unnecessary API calls
1 parent 68d85be commit 2109f44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/shared/widgets/searchable_dropdown_form_field.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class _SearchableSelectionDialogState<T, B extends BlocBase<S>, S>
141141
}
142142

143143
void _onScroll() {
144-
if (_isBottom) {
144+
final isLoading = widget.isLoadingExtractor(widget.bloc.state);
145+
if (_isBottom && !isLoading) {
145146
widget.onLoadMore();
146147
}
147148
}
@@ -228,4 +229,4 @@ class _SearchableSelectionDialogState<T, B extends BlocBase<S>, S>
228229
},
229230
);
230231
}
231-
}
232+
}

0 commit comments

Comments
 (0)