Fix this somehow-partially implemented dot shortcut
This commit is contained in:
parent
f6a9f7807e
commit
0fbc566454
|
@ -209,17 +209,13 @@ function Timeline({
|
||||||
const showNewPostsIndicator =
|
const showNewPostsIndicator =
|
||||||
items.length > 0 && uiState !== 'loading' && showNew;
|
items.length > 0 && uiState !== 'loading' && showNew;
|
||||||
const handleLoadNewPosts = useCallback(() => {
|
const handleLoadNewPosts = useCallback(() => {
|
||||||
loadItems(true);
|
if (showNewPostsIndicator) loadItems(true);
|
||||||
scrollableRef.current?.scrollTo({
|
scrollableRef.current?.scrollTo({
|
||||||
top: 0,
|
top: 0,
|
||||||
behavior: 'smooth',
|
behavior: 'smooth',
|
||||||
});
|
});
|
||||||
}, [loadItems]);
|
}, [loadItems, showNewPostsIndicator]);
|
||||||
const dotRef = useHotkeys('.', () => {
|
const dotRef = useHotkeys('.', handleLoadNewPosts);
|
||||||
if (showNewPostsIndicator) {
|
|
||||||
handleLoadNewPosts();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// const {
|
// const {
|
||||||
// scrollDirection,
|
// scrollDirection,
|
||||||
|
@ -365,6 +361,7 @@ function Timeline({
|
||||||
jRef.current = node;
|
jRef.current = node;
|
||||||
kRef.current = node;
|
kRef.current = node;
|
||||||
oRef.current = node;
|
oRef.current = node;
|
||||||
|
dotRef.current = node;
|
||||||
}}
|
}}
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue