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

Refactor custom logic to use the shared canResetTimeline() function #10403

Merged

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Mar 17, 2023

Refactor custom logic to use the shared canResetTimeline() function

Split out from #8354 (comment)

Dev notes

public canResetTimeline = (): boolean => this.messagePanel?.current?.isAtBottom();

public canResetTimeline = (): boolean => {
if (!this.messagePanel) {
return true;
}
return this.messagePanel.canResetTimeline();
};

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@MadLittleMods MadLittleMods added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Mar 17, 2023
@@ -773,7 +773,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
private onRoomTimelineReset = (room: Room, timelineSet: EventTimelineSet): void => {
if (timelineSet !== this.props.timelineSet) return;

if (this.messagePanel.current && this.messagePanel.current.isAtBottom()) {
if (this.canResetTimeline()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is equivalent to before:

public canResetTimeline = (): boolean => this.messagePanel?.current?.isAtBottom();

@MadLittleMods MadLittleMods merged commit 5b2e12c into develop Mar 20, 2023
@MadLittleMods MadLittleMods deleted the madlittlemods/fix-missed-refactor-canResetTimeline branch March 20, 2023 15:58
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @weeman1337 🐢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants