File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,16 @@ class LoadMoreSoundFiles extends ReduxAction<AppState> {
6464 final int pageToLoad;
6565 final int pageSize;
6666
67+ @override
68+ void before () {
69+ dispatch (SetSelectedSoundLoading (true ));
70+ }
71+
72+ @override
73+ void after () {
74+ dispatch (SetSelectedSoundLoading (false ));
75+ }
76+
6777 @override
6878 Future <AppState ?> reduce () async {
6979 if (state.selectedSoundEvent == null ) return null ;
@@ -72,6 +82,8 @@ class LoadMoreSoundFiles extends ReduxAction<AppState> {
7282 final soundClient = ApiService ().soundApi as SoundClientApi ;
7383 final PaginatedResult <SoundFileSource > files = await soundClient.getFiles (
7484 model.id! ,
85+ pageToLoad,
86+ pageSize,
7587 );
7688 final PaginatedResult <SoundFileSource > entries = model.files;
7789
@@ -87,3 +99,16 @@ class LoadMoreSoundFiles extends ReduxAction<AppState> {
8799 return state.copyWith (selectedSoundEvent: updatedSoundEvent);
88100 }
89101}
102+
103+ class SetSelectedSoundLoading extends ReduxAction <AppState > {
104+ SetSelectedSoundLoading (this .isLoading);
105+
106+ final bool isLoading;
107+
108+ @override
109+ AppState ? reduce () {
110+ final sel = state.selectedSoundEvent;
111+ if (sel == null ) return null ;
112+ return state.copyWith (selectedSoundEvent: sel.copyWith (isLoading: isLoading));
113+ }
114+ }
Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ class SelectedSoundState
2525 selectedEvent.files.hasNextPage &&
2626 ! selectedEvent.isLoading) {
2727 dispatch (
28- LoadMoreSoundFiles (pageToLoad: selectedEvent.files.currentPage + 1 ),
28+ LoadMoreSoundFiles (
29+ pageToLoad: selectedEvent.files.currentPage + 1 ,
30+ pageSize: selectedEvent.files.pageSize > 0
31+ ? selectedEvent.files.pageSize
32+ : 20 ,
33+ ),
2934 );
3035 }
3136 },
You can’t perform that action at this time.
0 commit comments