Skip to content

Commit

Permalink
Fix batched rendering when mcvp adjustment changes
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Mar 4, 2023
1 parent 9fbdb85 commit f673c7d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
}
}

componentDidUpdate(prevProps: Props) {
componentDidUpdate(prevProps: Props, prevState: State) {
const {data, extraData} = this.props;
if (data !== prevProps.data || extraData !== prevProps.extraData) {
// clear the viewableIndices cache to also trigger
Expand All @@ -1179,6 +1179,15 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
if (hiPriInProgress) {
this._hiPriInProgress = false;
}

// Make sure to cancel any pending updates if maintainVisibleContentPositionAdjustment
// changed since they are now invalid.
if (
prevState.maintainVisibleContentPositionAdjustment !==
this.state.maintainVisibleContentPositionAdjustment
) {
this._updateCellsToRenderBatcher.dispose({abort: true});
}
}

_averageCellLength = 0;
Expand Down

0 comments on commit f673c7d

Please sign in to comment.