Skip to content

quick ci of tree #4446

Merged
damienwebdev merged 4 commits intodevelopfrom
tree-signals-plus-daffio-fixes
Apr 17, 2026
Merged

quick ci of tree #4446
damienwebdev merged 4 commits intodevelopfrom
tree-signals-plus-daffio-fixes

Conversation

@damienwebdev
Copy link
Copy Markdown
Member

This is just a test run of #4408 before merge as there were slight adjustments.

@damienwebdev damienwebdev requested review from a team as code owners April 17, 2026 19:11
@damienwebdev damienwebdev force-pushed the tree-signals-plus-daffio-fixes branch from 8f60a3f to 35edbd8 Compare April 17, 2026 19:16
)

After f32fa78 split the docs routes into separate design and storefront
subtrees, the `index` resolver now lives on the section-level parent
route while `useDaffioNavList` is invoked from components mounted on
child route segments. Angular's `ActivatedRoute.data` only exposes the
current segment's data, so `data.index` was `undefined` and the old
composable leaked `undefined` through to consumers (it lacked a
`filter(Boolean)` after the `map`).

Switching to `DaffRouterDataService.data$` reads the merged data of the
entire activated route tree, so the ancestor-resolved `index` is
visible regardless of which segment the consumer lives on. An added
trailing `filter(Boolean)` also guards against the brief window where
the merged data object emits before `index` has been resolved.
The `distinctUntilChanged()` applied to the `combineLatest` tuple in `DaffioSidebarService.activeRegistration$` was a no-op — each upstream emission produces a new array, so reference equality never dedupes. Every route-data re-emission therefore forwarded a (possibly identical) registration downstream, causing subscribers to react to router changes even when the active sidebar hadn't changed.

Move the operator after the `map` and compare by `registration.id` so the stream only emits when the sidebar registration actually changes
This also brings three new features:

- Node IDs are now scoped to each tree instance: ids are composed as `<treeId>.<id>` down the ancestor chain.

- `DaffTreeComponent` exposes an `id` input with an auto-incrementing fallback so multiple trees on the same page nlonger collide on element IDs.

- When a tree item becomes `selected`, the item opens its full ancestor chain via the new `daffTreeOpenAncestors` helper and notifies the tree to re-flatten, so selected items are revealed without consumers having to call `open` manually.

BREAKING CHANGE: `DaffTreeComponent` and `DaffTreeItemDirective` now expose their inputs (`tree`, `renderMode`, `node`, `selected`), content queries (`withChildrenTemplate`, `treeItemTemplate`), and the public `flatTree` field as signals rather than plain properties. Template bindings (`[tree]="data"`) continue to work, but any programmatic reads must invoke the signal: `component.flatTree` → `component.flatTree()`, `component.tree` → `component.tree()`,`directive.node` → `directive.node()`, and so on. Consumers that read these fields from tests or component code must update accordingly.
@damienwebdev damienwebdev force-pushed the tree-signals-plus-daffio-fixes branch from 35edbd8 to 03cfe38 Compare April 17, 2026 19:21
@damienwebdev damienwebdev merged commit 03cfe38 into develop Apr 17, 2026
3 checks passed
@damienwebdev damienwebdev deleted the tree-signals-plus-daffio-fixes branch April 17, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant