Add "clean up timer if necessary" utility

This commit is contained in:
Evan Hahn 2022-02-25 12:37:15 -06:00 committed by GitHub
parent c2a65306e2
commit 052a8e65e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 150 additions and 137 deletions

View file

@ -6,6 +6,7 @@ import classNames from 'classnames';
import moment from 'moment';
import { formatTime } from '../../util/timestamp';
import { clearTimeoutIfNecessary } from '../../util/clearTimeoutIfNecessary';
import type { LocalizerType } from '../../types/Util';
@ -42,9 +43,7 @@ export class MessageTimestamp extends React.Component<Props> {
}
public override componentWillUnmount(): void {
if (this.interval) {
clearInterval(this.interval);
}
clearTimeoutIfNecessary(this.interval);
}
public override render(): JSX.Element | null {