Fix thread list jumping back down while scrolling (#9606)

* Fix timeline jumping after every thread update

* Add tests to prevent this from occuring again
This commit is contained in:
Janne Mareike Koschinski 2022-11-25 13:22:06 +01:00 committed by GitHub
parent 5c60211d76
commit 55d9dbf00d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 218 additions and 25 deletions

View file

@ -16,7 +16,7 @@ limitations under the License.
import React, { useContext, useEffect, useRef, useState } from 'react';
import { EventTimelineSet } from 'matrix-js-sdk/src/models/event-timeline-set';
import { Thread, ThreadEvent } from 'matrix-js-sdk/src/models/thread';
import { Thread } from 'matrix-js-sdk/src/models/thread';
import { Room } from 'matrix-js-sdk/src/models/room';
import BaseCard from "../views/right_panel/BaseCard";
@ -206,18 +206,6 @@ const ThreadPanel: React.FC<IProps> = ({
});
}, [mxClient, roomId]);
useEffect(() => {
function refreshTimeline() {
timelinePanel?.current.refreshTimeline();
}
room?.on(ThreadEvent.Update, refreshTimeline);
return () => {
room?.removeListener(ThreadEvent.Update, refreshTimeline);
};
}, [room, mxClient, timelineSet]);
useEffect(() => {
if (room) {
if (filterOption === ThreadFilterType.My) {