Skip to content

Commit 2aef72e

Browse files
committed
client: Restore spinner even when the event has been cancelled
The aborting short circuit has been introduced in 28d27f3 It can happen that the request is cancelled by another request but the second request will use `setLoadingState` instead of `setMoreLoadingState` so `moreLoadingState` will be stuck on `LOADING`. Not sure if it this cannot introduce a race if the same state is used in both requests. Tried testing with {let a = new AbortController(); let f = fetch('wait.php?seconds=3', {signal: a.signal}); f.then(r => console.log(r, a)); setTimeout(() => {a.abort(); f.then((r) => console.log(r, a.signal))}, 100);}
1 parent 3d77e1e commit 2aef72e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client/js/templates/EntriesPage.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ function reloadList({
111111

112112
setLoadingState(LoadingState.LOADING);
113113
return reloader(fetchParams, abortController).then(({ entries, hasMore }) => {
114+
setLoadingState(LoadingState.SUCCESS);
115+
selfoss.entriesPage.setHasMore(hasMore);
116+
114117
if (abortController.signal.aborted) {
115118
return;
116119
}
117120

118-
setLoadingState(LoadingState.SUCCESS);
119-
selfoss.entriesPage.setHasMore(hasMore);
120-
121121
if (append) {
122122
selfoss.entriesPage.appendEntries(entries);
123123
} else {

0 commit comments

Comments
 (0)