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 ed156ff commit 1076790
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
);

if (maintainVisibleContentPositionAdjustment != null) {
console.log(
'maintainVisibleContentPositionAdjustment',
maintainVisibleContentPositionAdjustment,
);
renderMask.addCells({
first:
cellsAroundViewport.first +
Expand Down Expand Up @@ -1133,7 +1137,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 @@ -1155,6 +1159,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 1076790

Please sign in to comment.