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,9 +128,13 @@ 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
if (hasMore && !loading && selectedEntry === entries[entries.length - 1]) {
await dispatch(loadMoreEntries())
}
await dispatch( await dispatch(
selectNextEntry({ selectNextEntry({
expand: true, expand: true,
@@ -138,10 +142,14 @@ export function FeedEntries() {
scrollToEntry: true, scrollToEntry: true,
}) })
) )
) })
useMousetrap( useMousetrap("n", async () => {
"n", // 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
if (hasMore && !loading && selectedEntry === entries[entries.length - 1]) {
await dispatch(loadMoreEntries())
}
await dispatch( await dispatch(
selectNextEntry({ selectNextEntry({
expand: false, expand: false,
@@ -149,7 +157,7 @@ export function FeedEntries() {
scrollToEntry: true, scrollToEntry: true,
}) })
) )
) })
useMousetrap( useMousetrap(
"k", "k",
async () => async () =>