From aad192d150238a39850b415470aeebf03696c9aa Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 3 Jun 2022 12:38:54 -0500 Subject: [PATCH] ScrollTopButton: restore `count` prop so it works in Notifications again --- app/soapbox/components/scroll-top-button.tsx | 7 +++---- app/soapbox/features/ui/components/timeline.tsx | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/soapbox/components/scroll-top-button.tsx b/app/soapbox/components/scroll-top-button.tsx index 11ceb9e40..8fed6cc78 100644 --- a/app/soapbox/components/scroll-top-button.tsx +++ b/app/soapbox/components/scroll-top-button.tsx @@ -5,12 +5,12 @@ import { useIntl, MessageDescriptor } from 'react-intl'; import Icon from 'soapbox/components/icon'; import { Text } from 'soapbox/components/ui'; -import { useAppSelector, useSettings } from 'soapbox/hooks'; +import { useSettings } from 'soapbox/hooks'; import { shortNumberFormat } from 'soapbox/utils/numbers'; interface IScrollTopButton { onClick: () => void, - timelineId: string, + count: number, message: MessageDescriptor, threshold?: number, autoloadThreshold?: number, @@ -18,14 +18,13 @@ interface IScrollTopButton { const ScrollTopButton: React.FC = ({ onClick, - timelineId, + count, message, threshold = 400, autoloadThreshold = 50, }) => { const intl = useIntl(); const settings = useSettings(); - const count = useAppSelector(state => state.timelines.getIn([timelineId, 'totalQueuedItemsCount'])); const [scrolled, setScrolled] = useState(false); const autoload = settings.get('autoloadTimelines') === true; diff --git a/app/soapbox/features/ui/components/timeline.tsx b/app/soapbox/features/ui/components/timeline.tsx index 2c143d8fd..74efaac2e 100644 --- a/app/soapbox/features/ui/components/timeline.tsx +++ b/app/soapbox/features/ui/components/timeline.tsx @@ -31,6 +31,7 @@ const Timeline: React.FC = ({ const isLoading = useAppSelector(state => state.timelines.getIn([timelineId, 'isLoading'], true) === true); const isPartial = useAppSelector(state => state.timelines.getIn([timelineId, 'isPartial'], false) === true); const hasMore = useAppSelector(state => state.timelines.getIn([timelineId, 'hasMore']) === true); + const totalQueuedItemsCount = useAppSelector(state => state.timelines.getIn([timelineId, 'totalQueuedItemsCount'])); const handleDequeueTimeline = () => { dispatch(dequeueTimeline(timelineId, onLoadMore)); @@ -49,7 +50,7 @@ const Timeline: React.FC = ({