forked from Archives/Athou_commafeed
manually load more entries if needed when pressing a keyboard shortcut to go to the next entry (#1557)
This commit is contained in:
@@ -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 () =>
|
||||||
|
|||||||
Reference in New Issue
Block a user