Skip to content

Commit f673c7d

Browse files
Fix batched rendering when mcvp adjustment changes
1 parent 9fbdb85 commit f673c7d

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
@@ -1157,7 +1157,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11571157
}
11581158
}
11591159

1160-
componentDidUpdate(prevProps: Props) {
1160+
componentDidUpdate(prevProps: Props, prevState: State) {
11611161
const {data, extraData} = this.props;
11621162
if (data !== prevProps.data || extraData !== prevProps.extraData) {
11631163
// clear the viewableIndices cache to also trigger
@@ -1179,6 +1179,15 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
11791179
if (hiPriInProgress) {
11801180
this._hiPriInProgress = false;
11811181
}
1182+
1183+
// Make sure to cancel any pending updates if maintainVisibleContentPositionAdjustment
1184+
// changed since they are now invalid.
1185+
if (
1186+
prevState.maintainVisibleContentPositionAdjustment !==
1187+
this.state.maintainVisibleContentPositionAdjustment
1188+
) {
1189+
this._updateCellsToRenderBatcher.dispose({abort: true});
1190+
}
11821191
}
11831192

11841193
_averageCellLength = 0;

0 commit comments

Comments
 (0)