From 0fbc566454f6e4b8cfda1ebe87e2d32b781e49d3 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 24 Mar 2024 00:21:41 +0800 Subject: [PATCH] Fix this somehow-partially implemented dot shortcut --- src/components/timeline.jsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index c91f4a91..84b234ed 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -209,17 +209,13 @@ function Timeline({ const showNewPostsIndicator = items.length > 0 && uiState !== 'loading' && showNew; const handleLoadNewPosts = useCallback(() => { - loadItems(true); + if (showNewPostsIndicator) loadItems(true); scrollableRef.current?.scrollTo({ top: 0, behavior: 'smooth', }); - }, [loadItems]); - const dotRef = useHotkeys('.', () => { - if (showNewPostsIndicator) { - handleLoadNewPosts(); - } - }); + }, [loadItems, showNewPostsIndicator]); + const dotRef = useHotkeys('.', handleLoadNewPosts); // const { // scrollDirection, @@ -365,6 +361,7 @@ function Timeline({ jRef.current = node; kRef.current = node; oRef.current = node; + dotRef.current = node; }} tabIndex="-1" >