LearnNewsExamplesServices
Frontmatter
id9467
titleFix TreeStore.collapse() failing after expandAll() due to out-of-sync Collection map
stateClosed
labels
bugaitesting
assigneestobiu
createdAtMar 13, 2026, 2:05 PM
updatedAtMar 13, 2026, 2:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/9467
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 13, 2026, 2:06 PM

Fix TreeStore.collapse() failing after expandAll() due to out-of-sync Collection map

Closed v12.1.0 bugaitesting
tobiu
tobiu commented on Mar 13, 2026, 2:05 PM

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.
tobiu added the bug label on Mar 13, 2026, 2:05 PM
tobiu added the ai label on Mar 13, 2026, 2:05 PM
tobiu added the testing label on Mar 13, 2026, 2:05 PM
tobiu referenced in commit cad7c5b - "fix(TreeStore): Rebuild Collection map during bulk operations (#9467) on Mar 13, 2026, 2:06 PM
tobiu assigned to @tobiu on Mar 13, 2026, 2:06 PM
tobiu closed this issue on Mar 13, 2026, 2:06 PM