From 1c9651f557c1ed4830c85cdb9185a059f9dba98f Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Tue, 1 Aug 2023 10:24:45 -0700 Subject: [PATCH] Revert "optimize timeline scroll performance" --- ts/components/conversation/Timeline.tsx | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/ts/components/conversation/Timeline.tsx b/ts/components/conversation/Timeline.tsx index 035b7290a..dd62c58bd 100644 --- a/ts/components/conversation/Timeline.tsx +++ b/ts/components/conversation/Timeline.tsx @@ -399,14 +399,12 @@ export class Timeline extends React.Component< const newestBottomVisibleMessageId = getMessageIdFromElement(newestBottomVisible); - this.updatePartiallyVisibleMessageIds( + this.setState({ oldestPartiallyVisibleMessageId, - newestBottomVisibleMessageId - ); + newestBottomVisibleMessageId, + }); - if (this.props.isNearBottom !== newIsNearBottom) { - setIsNearBottom(id, newIsNearBottom); - } + setIsNearBottom(id, newIsNearBottom); if (newestBottomVisibleMessageId) { this.markNewestBottomVisibleMessageRead(); @@ -463,19 +461,6 @@ export class Timeline extends React.Component< this.intersectionObserver.observe(atBottomDetectorEl); } - private updatePartiallyVisibleMessageIds = throttle( - ( - oldestPartiallyVisibleMessageId: string | undefined, - newestBottomVisibleMessageId: string | undefined - ) => { - this.setState({ - oldestPartiallyVisibleMessageId, - newestBottomVisibleMessageId, - }); - }, - 100 - ); - private markNewestBottomVisibleMessageRead = throttle((): void => { const { id, markMessageRead } = this.props; const { newestBottomVisibleMessageId } = this.state;