From bf7e01285850e765fff0117609194c8e805f210a Mon Sep 17 00:00:00 2001 From: Mikyung Kim Date: Fri, 6 Dec 2024 14:03:04 +0900 Subject: [PATCH] WRR-12807: Fixed `VirtualList` to not abnormally scroll when `dataSize` and `itemSizes` changed (#3300) * WRR-12807: Fixed `VirtualList` to not abnormally scroll when `dataSize` and `itemSizes` changed Enact-DCO-1.0-Signed-off-by: Mikyung Kim (mikyung27.kim@lge.com) * fix typo Enact-DCO-1.0-Signed-off-by: Mikyung Kim (mikyung27.kim@lge.com) --- packages/ui/CHANGELOG.md | 6 ++++++ packages/ui/VirtualList/VirtualListBasic.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index caea364a54..d5e43954ad 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -2,6 +2,12 @@ The following is a curated list of changes in the Enact ui module, newest changes on the top. +## [unreleased] + +### Fixed + +- `ui/VirtualList` to not abnormally scroll when `dataSize` and `itemSizes` changed + ## [5.0.0-alpha.3] - 2024-12-02 ### Fixed diff --git a/packages/ui/VirtualList/VirtualListBasic.js b/packages/ui/VirtualList/VirtualListBasic.js index d014cb8a30..84e8c91005 100644 --- a/packages/ui/VirtualList/VirtualListBasic.js +++ b/packages/ui/VirtualList/VirtualListBasic.js @@ -407,7 +407,7 @@ class VirtualListBasic extends Component { prevProps.overhang !== this.props.overhang || prevProps.spacing !== this.props.spacing || !equals(prevProps.itemSize, this.props.itemSize) || - !shallowEqual(prevProps.itemSizes, this.props.itemSizes) + (!this.hasDataSizeChanged && !shallowEqual(prevProps.itemSizes, this.props.itemSizes)) ) { const {x, y} = this.getXY(this.scrollPosition, 0);