Skip to content

Commit 45a0225

Browse files
Fix batched rendering when mcvp adjustment changes
1 parent d684bf0 commit 45a0225

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
@@ -1163,7 +1163,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11631163
}
11641164
}
11651165

1166-
componentDidUpdate(prevProps: Props) {
1166+
componentDidUpdate(prevProps: Props, prevState: State) {
11671167
const {data, extraData} = this.props;
11681168
if (data !== prevProps.data || extraData !== prevProps.extraData) {
11691169
// clear the viewableIndices cache to also trigger
@@ -1185,6 +1185,15 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11851185
if (hiPriInProgress) {
11861186
this._hiPriInProgress = false;
11871187
}
1188+
1189+
// Make sure to cancel any pending updates if maintainVisibleContentPositionAdjustment
1190+
// changed since they are now invalid.
1191+
if (
1192+
prevState.maintainVisibleContentPositionAdjustment !==
1193+
this.state.maintainVisibleContentPositionAdjustment
1194+
) {
1195+
this._updateCellsToRenderBatcher.dispose({abort: true});
1196+
}
11881197
}
11891198

11901199
_averageCellLength = 0;

0 commit comments

Comments
 (0)