TraceView: Fix broken rendering when scrolling in Dashboard panel in Firefox (#56642)

This commit is contained in:
zdg-github 2022-11-24 18:49:55 +08:00 committed by GitHub
parent 276b54fe9d
commit a2f1d2e102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,10 +215,20 @@ export default class ListView extends React.Component<TListViewProps> {
} }
} }
componentDidUpdate() { componentDidUpdate(prevProps: TListViewProps) {
if (this._itemHolderElm) { if (this._itemHolderElm) {
this._scanItemHeights(); this._scanItemHeights();
} }
// When windowScroller is set to false, we can continue to handle scrollElement
if (this.props.windowScroller) {
return;
}
// check if the scrollElement changes and update its scroll listener
if (prevProps.scrollElement !== this.props.scrollElement) {
prevProps.scrollElement?.removeEventListener('scroll', this._onScroll);
this._wrapperElm = this.props.scrollElement;
this._wrapperElm?.addEventListener('scroll', this._onScroll);
}
} }
componentWillUnmount() { componentWillUnmount() {