From b98a3b4099f76e73afc675094c9e1a026ff3ef29 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 19 Jan 2021 23:00:18 +0100 Subject: [PATCH] client: Clear entries on list reload 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. --- assets/js/templates/EntriesPage.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/js/templates/EntriesPage.jsx b/assets/js/templates/EntriesPage.jsx index b5c3108930..6ca28e2927 100644 --- a/assets/js/templates/EntriesPage.jsx +++ b/assets/js/templates/EntriesPage.jsx @@ -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);