Frontmatter
| id | 9433 |
| title | TreeStore: Implement bulk expandAll() and collapseAll() methods |
| state | Closed |
| labels | enhancementaiarchitecturegrid |
| assignees | tobiu |
| createdAt | Mar 10, 2026, 3:26 PM |
| updatedAt | Mar 11, 2026, 10:55 AM |
| githubUrl | https://github.com/neomjs/neo/issues/9433 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 9404 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 11, 2026, 10:55 AM |
TreeStore: Implement bulk expandAll() and collapseAll() methods
tobiu added parent issue #9404 on Mar 10, 2026, 3:27 PM
tobiu assigned to @tobiu on Mar 10, 2026, 3:29 PM

tobiu
Mar 11, 2026, 10:54 AM
Input from Gemini 3.1 Pro:
✦ The bulk expandAll() and collapseAll() methods have been implemented in
TreeStore.mjsaccording to the acceptance criteria.
- Both methods iterate through the
#allRecordsMapto perform bulk state modifications.- They handle both
Neo.data.Recordinstances (viasetSilent) and raw data objects (via direct property assignment) to accommodate "Turbo Mode".- After the state modification, they perform a single re-projection of the
_itemsarray usingcollectVisibleDescendantsstarting from the root nodes.- Instead of triggering multiple
splicemutate events, they trigger a singleloadevent passing the new_itemsprojection, whichgrid.Containerand other views already listen to for complete refreshes.- Unit tests have been added to
test/playwright/unit/data/TreeStore.spec.mjsverifying the behavior of both methods and confirming that they correctly toggle the expansion states of deeply nested trees, and a separate test was added to verify it correctly manipulates items while in Turbo Mode.The code is committed and pushed to the repository. I'll close this ticket now.
tobiu closed this issue on Mar 11, 2026, 10:55 AM
Goal
Provide
expandAll()andcollapseAll()methods to toggle the entire tree state efficiently without locking the UI thread.Context
Currently,
TreeStoreonly supports toggling individual nodes viaexpand(nodeId)andcollapse(nodeId). Each call triggers a localized recalculation of the visible projection (_items) and a UI update. If a user needs to expand a deeply nested tree with 5,000 nodes, doing so in a loop would cause 5,000 recalculations, freezing the App Worker.Acceptance Criteria
expandAll()andcollapseAll()inTreeStore.mjs.#allRecordsMapand flip thecollapsedboolean on every node (silently, without triggering individual events if possible)._itemsprojection must be rebuilt once from the roots.mutateorrefreshevent to update the UI.TreeStore.spec.mjsto verify bulk expanding/collapsing on a deep hierarchy.