mirror of
https://github.com/ascribe/onion.git
synced 2025-02-01 20:39:57 +01:00
display spinner on pagination request
This commit is contained in:
parent
6e1cf55841
commit
2d28c00d0f
@ -14,6 +14,21 @@ class PieceListActions {
|
||||
}
|
||||
|
||||
fetchPieceList(page, pageSize, search, orderBy, orderAsc) {
|
||||
// To prevent flickering on a pagination request,
|
||||
// we overwrite the piecelist with an empty list before
|
||||
// pieceListCount === -1 defines the loading state
|
||||
this.actions.updatePieceList({
|
||||
page,
|
||||
pageSize,
|
||||
search,
|
||||
orderBy,
|
||||
orderAsc,
|
||||
'pieceList': [],
|
||||
'pieceListCount': -1
|
||||
});
|
||||
|
||||
// afterwards, we can load the list
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
PieceListFetcher
|
||||
.fetch(page, pageSize, search, orderBy, orderAsc)
|
||||
|
@ -19,6 +19,7 @@ class PieceListStore {
|
||||
* the number of items the resource actually - without pagination - provides.
|
||||
*/
|
||||
this.pieceList = [];
|
||||
// -1 specifies that the store is currently loading
|
||||
this.pieceListCount = -1;
|
||||
this.page = 1;
|
||||
this.pageSize = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user