Skip to content

Commit

Permalink
client: Clear entries on list reload
Browse files Browse the repository at this point in the history
We should just remove the old list while the new one is loading to make the interface cleaner.
Also clearing a selected item is necessary to avoid navigation using shortcuts not working after switching to a different tag since the ui functions assume the selected item exists.
  • Loading branch information
jtojnar committed Jan 26, 2021
1 parent 2923c90 commit b98a3b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/js/templates/EntriesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ function reloadList({ fetchParams, append = false, waitForSync = true, entryId =
reloader = selfoss.dbOnline.reloadList;
}

// Clean state when not just adding items.
if (!append) {
selfoss.entriesPage.setHasMore(false);
selfoss.entriesPage.setExpandedEntries({});
selfoss.entriesPage.setEntries([]);
selfoss.entriesPage.setSelectedEntry(null);
}

setLoadingState(LoadingState.LOADING);
reloader(fetchParams).then(({ entries, hasMore }) => {
setLoadingState(LoadingState.SUCCESS);
Expand Down

0 comments on commit b98a3b4

Please sign in to comment.