Skip to content

Commit 3379aec

Browse files
Fix batched rendering when mcvp adjustment changes
1 parent ed156ff commit 3379aec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/virtualized-lists/Lists/VirtualizedList.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11331133
}
11341134
}
11351135

1136-
componentDidUpdate(prevProps: Props) {
1136+
componentDidUpdate(prevProps: Props, prevState: State) {
11371137
const {data, extraData} = this.props;
11381138
if (data !== prevProps.data || extraData !== prevProps.extraData) {
11391139
// clear the viewableIndices cache to also trigger
@@ -1155,6 +1155,15 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11551155
if (hiPriInProgress) {
11561156
this._hiPriInProgress = false;
11571157
}
1158+
1159+
// Make sure to cancel any pending updates if maintainVisibleContentPositionAdjustment
1160+
// changed since they are now invalid.
1161+
if (
1162+
prevState.maintainVisibleContentPositionAdjustment !==
1163+
this.state.maintainVisibleContentPositionAdjustment
1164+
) {
1165+
this._updateCellsToRenderBatcher.dispose({abort: true});
1166+
}
11581167
}
11591168

11601169
_averageCellLength = 0;

0 commit comments

Comments
 (0)