manually load more entries if needed when pressing a keyboard shortcut to go to the next entry (#1557)

This commit is contained in:
Athou
2024-09-18 16:23:53 +02:00
parent ee7c6792c9
commit 191574dace

View File

@@ -128,28 +128,36 @@ export function FeedEntries() {
}, [dispatch, entries, viewMode, scrollMarks, scrollingToEntry]) }, [dispatch, entries, viewMode, scrollMarks, scrollingToEntry])
useMousetrap("r", async () => await dispatch(reloadEntries())) useMousetrap("r", async () => await dispatch(reloadEntries()))
useMousetrap( useMousetrap("j", async () => {
"j", // load more entries if needed
async () => // this can happen if the last entry is too large to fit on the screen and the infinite loader doesn't trigger
await dispatch( if (hasMore && !loading && selectedEntry === entries[entries.length - 1]) {
selectNextEntry({ await dispatch(loadMoreEntries())
expand: true, }
markAsRead: true,
scrollToEntry: true, await dispatch(
}) selectNextEntry({
) expand: true,
) markAsRead: true,
useMousetrap( scrollToEntry: true,
"n", })
async () => )
await dispatch( })
selectNextEntry({ useMousetrap("n", async () => {
expand: false, // load more entries if needed
markAsRead: false, // this can happen if the last entry is too large to fit on the screen and the infinite loader doesn't trigger
scrollToEntry: true, if (hasMore && !loading && selectedEntry === entries[entries.length - 1]) {
}) await dispatch(loadMoreEntries())
) }
)
await dispatch(
selectNextEntry({
expand: false,
markAsRead: false,
scrollToEntry: true,
})
)
})
useMousetrap( useMousetrap(
"k", "k",
async () => async () =>