Remove React Virtualized from <Timeline>
This commit is contained in:
parent
1eafe79905
commit
0c31ad25ef
40 changed files with 798 additions and 2512 deletions
|
@ -23,6 +23,8 @@ import { SendStatus } from '../../messages/MessageSendState';
|
|||
import { WidthBreakpoint } from '../_util';
|
||||
import * as log from '../../logging/log';
|
||||
import { formatDateTimeLong } from '../../util/timestamp';
|
||||
import { clearTimeoutIfNecessary } from '../../util/clearTimeoutIfNecessary';
|
||||
import { MINUTE } from '../../util/durations';
|
||||
|
||||
export type Contact = Pick<
|
||||
ConversationType,
|
||||
|
@ -98,16 +100,20 @@ export type PropsReduxActions = Pick<
|
|||
export type ExternalProps = PropsData & PropsBackboneActions;
|
||||
export type Props = PropsData & PropsBackboneActions & PropsReduxActions;
|
||||
|
||||
type State = { nowThatUpdatesEveryMinute: number };
|
||||
|
||||
const contactSortCollator = new Intl.Collator();
|
||||
|
||||
const _keyForError = (error: Error): string => {
|
||||
return `${error.name}-${error.message}`;
|
||||
};
|
||||
|
||||
export class MessageDetail extends React.Component<Props> {
|
||||
private readonly focusRef = React.createRef<HTMLDivElement>();
|
||||
export class MessageDetail extends React.Component<Props, State> {
|
||||
override state = { nowThatUpdatesEveryMinute: Date.now() };
|
||||
|
||||
private readonly focusRef = React.createRef<HTMLDivElement>();
|
||||
private readonly messageContainerRef = React.createRef<HTMLDivElement>();
|
||||
private nowThatUpdatesEveryMinuteInterval?: ReturnType<typeof setInterval>;
|
||||
|
||||
public override componentDidMount(): void {
|
||||
// When this component is created, it's initially not part of the DOM, and then it's
|
||||
|
@ -117,6 +123,14 @@ export class MessageDetail extends React.Component<Props> {
|
|||
this.focusRef.current.focus();
|
||||
}
|
||||
});
|
||||
|
||||
this.nowThatUpdatesEveryMinuteInterval = setInterval(() => {
|
||||
this.setState({ nowThatUpdatesEveryMinute: Date.now() });
|
||||
}, MINUTE);
|
||||
}
|
||||
|
||||
public override componentWillUnmount(): void {
|
||||
clearTimeoutIfNecessary(this.nowThatUpdatesEveryMinuteInterval);
|
||||
}
|
||||
|
||||
public renderAvatar(contact: Contact): JSX.Element {
|
||||
|
@ -298,6 +312,7 @@ export class MessageDetail extends React.Component<Props> {
|
|||
showVisualAttachment,
|
||||
theme,
|
||||
} = this.props;
|
||||
const { nowThatUpdatesEveryMinute } = this.state;
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
||||
|
@ -335,7 +350,7 @@ export class MessageDetail extends React.Component<Props> {
|
|||
markAttachmentAsCorrupted={markAttachmentAsCorrupted}
|
||||
markViewed={markViewed}
|
||||
messageExpanded={noop}
|
||||
onHeightChange={noop}
|
||||
now={nowThatUpdatesEveryMinute}
|
||||
openConversation={openConversation}
|
||||
openLink={openLink}
|
||||
reactToMessage={reactToMessage}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue