[WC-3564]Fix: Tree node v2 loading sort expansion - #2437
Conversation
This comment has been minimized.
This comment has been minimized.
8871cdd to
55be357
Compare
This comment has been minimized.
This comment has been minimized.
55be357 to
13fdda0
Compare
This comment has been minimized.
This comment has been minimized.
13fdda0 to
46eff63
Compare
This comment has been minimized.
This comment has been minimized.
46eff63 to
b94dda1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…very history The v2 preload filter was built by accumulating what had already been fetched (appendItems, bootstrap rounds, the startExpanded cascade and a late-arrival sweep, across five refs). When an app-level constraint replaced the whole result set - a gallery filtering the tree by department - those history gates had already locked in, so the filter stayed frozen at the first set's parents. Nodes from the new set arrived with no children, hence no expand icon, no aria-expanded and no keyboard handler. Replace all of it with a set derived from the current tree on every pass: the root level, every node whose subtree is rendered, and the children of those nodes. setFilter runs only when the derived set differs from the last applied one (sorted-id key). A root is strictly parentId === undefined, so an orphan renders at root level but is not a root for retrieval - that is what keeps the tree -> filter -> tree cycle terminating. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ding-state Promote the change's delta specs into the package's main specs (tree-node-data-refresh: 3 requirements / 9 scenarios; tree-node-expand-state: 8 requirements / 25 scenarios) and move the change to openspec/changes/archive/2026-09-22-fix-tree-node-loading-state. Archived with tasks 13.1-13.5 unchecked: those are live-verification steps against the WC-3564 repro project, not code work. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
71780c0 to
421077f
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI check status could not be retrieved automatically. Task log entries 15.10 and 16.8 record 95/95 unit tests passing and Findings
|
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
This PR fixes several Tree Node v2 regressions related to data refresh, sorting, and expanded state handling. It keeps nodes expanded/collapsed correctly after datasource reloads, reapplies the correct sort order when the data source changes, and restores missing expand icons/loading behavior for deeper nodes and microflow/filter-driven trees. It also adds regression tests to cover the reported scenarios.