Use stable keys for rendering timeline

This commit is contained in:
Fedor Indutny 2021-08-17 11:41:12 -07:00 committed by GitHub
parent 4a6d28e118
commit 6dcceb81ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -680,6 +680,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
const typingBubbleRow = this.getTypingBubbleRow();
let rowContents: ReactNode;
let stableKey = key;
if (haveOldest && row === 0) {
rowContents = (
<div data-row={row} style={styleWithWidth} role="row">
@ -725,6 +726,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
);
}
const messageId = items[itemIndex];
stableKey = messageId;
rowContents = (
<div
@ -745,7 +747,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
<CellMeasurer
cache={this.cellSizeCache}
columnIndex={0}
key={key}
key={stableKey}
parent={parent}
rowIndex={index}
width={this.mostRecentWidth}