Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix timeline link to same event
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Sep 6, 2024
1 parent 33c9c04 commit 427b440
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ class TimelinePanel extends React.Component<IProps, IState> {
private callEventGroupers = new Map<string, LegacyCallEventGrouper>();
private initialReadMarkerId: string | null = null;

/**
* True when the user has scrolled
* Reset to false after a call of `loadTimeline`
* @private
*/
private scrolled = false;

public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context);

Expand Down Expand Up @@ -368,6 +375,9 @@ class TimelinePanel extends React.Component<IProps, IState> {
} else if (differentOverlayTimeline) {
logger.log(`TimelinePanel updating overlay timeline.`);
this.initTimeline(this.props);
} else if (this.props.eventScrollIntoView && this.scrolled) {
// If the user has scrolled, and we want to display again the same event
this.initTimeline(this.props);
}
}

Expand Down Expand Up @@ -659,6 +669,8 @@ class TimelinePanel extends React.Component<IProps, IState> {

private onMessageListScroll = (e: Event): void => {
this.props.onScroll?.(e);
this.scrolled = true;

if (this.props.manageReadMarkers) {
this.doManageReadMarkers();
}
Expand Down Expand Up @@ -1560,6 +1572,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// We need to skip over any which have subsequently been sent.
this.advanceReadMarkerPastMyEvents();

this.scrolled = false;
this.setState(
{
canBackPaginate:
Expand Down

0 comments on commit 427b440

Please sign in to comment.