Bug Description
When collapse() is called on a TreeStore node immediately after expandAll(), the node's descendants are not removed from the visible projection array, leaving the UI out of sync with the data state.
Root Cause
TreeStore uses #rebuildKeysAndCount() to quickly rebuild its visible projection (_items) after bulk operations like expandAll or filter. However, this method neglected to rebuild the Collection's internal map alongside the _items and _keys arrays.
When collapse(node) is subsequently called, it relies on me.indexOf(node) to find the start index for the removal splice. Because the map is out of sync, indexOf returns -1, and the super.splice() operation is bypassed entirely.
Solution
- Updated
TreeStore.#rebuildKeysAndCount() to correctly clear and populate me.map.
- Added a dedicated unit test
test/playwright/unit/data/TreeStoreCollapseBug.spec.mjs to prevent regressions.
- Updated the E2E tests in
GridTreeBigData.spec.mjs to use { force: true } on clicks to ensure stable execution within the ControlsContainer overflow area.
Bug Description
When
collapse()is called on aTreeStorenode immediately afterexpandAll(), the node's descendants are not removed from the visible projection array, leaving the UI out of sync with the data state.Root Cause
TreeStoreuses#rebuildKeysAndCount()to quickly rebuild its visible projection (_items) after bulk operations likeexpandAllorfilter. However, this method neglected to rebuild theCollection's internalmapalongside the_itemsand_keysarrays.When
collapse(node)is subsequently called, it relies onme.indexOf(node)to find the start index for the removal splice. Because themapis out of sync,indexOfreturns-1, and thesuper.splice()operation is bypassed entirely.Solution
TreeStore.#rebuildKeysAndCount()to correctly clear and populateme.map.test/playwright/unit/data/TreeStoreCollapseBug.spec.mjsto prevent regressions.GridTreeBigData.spec.mjsto use{ force: true }on clicks to ensure stable execution within the ControlsContainer overflow area.