[Perf] Message List: Avoid layout effect during animation
This commit is contained in:
parent
577d055d68
commit
f42c013efa
@ -422,6 +422,16 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
||||
const prevContainerHeight = prevContainerHeightRef.current;
|
||||
prevContainerHeightRef.current = containerHeight;
|
||||
|
||||
// Skip initial resize observer callback
|
||||
if (
|
||||
messageIds === prevMessageIds
|
||||
&& isViewportNewest === prevIsViewportNewest
|
||||
&& containerHeight !== prevContainerHeight
|
||||
&& prevContainerHeight === undefined
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const container = containerRef.current!;
|
||||
listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item'));
|
||||
const lastItemElement = listItemElementsRef.current[listItemElementsRef.current.length - 1];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user