Skip to content

Conversation

@jpzwarte
Copy link
Member

@jpzwarte jpzwarte commented Oct 29, 2025

Fixes #2806

@changeset-bot
Copy link

changeset-bot bot commented Oct 29, 2025

🦋 Changeset detected

Latest commit: 6d3e69f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sl-design-system/tree Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

🕸 Website preview

You can view a preview here (commit 6d3e69f4568b1f5c7ed3416e04ee8b3841091ace).

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

🕸 Storybook preview

You can view a preview here (commit 6d3e69f4568b1f5c7ed3416e04ee8b3841091ace).

@jpzwarte jpzwarte marked this pull request as ready for review October 29, 2025 10:25
@jpzwarte jpzwarte requested a review from Copilot October 29, 2025 10:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where lazy-loaded child nodes in a tree with multiple selection enabled were not inheriting the selected state from their parent node. When a selected parent node is expanded and its children are lazy-loaded, all children should automatically be selected to maintain consistent selection state.

Key Changes

  • Added logic to automatically select lazy-loaded children when their parent is already selected (in both NestedTreeDataSource and FlatTreeDataSource)
  • Added comprehensive test coverage for lazy loading scenarios in both data source implementations
  • Updated the LazyLoad story to enable multiple selection for better demonstration

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/components/tree/src/nested-tree-data-source.ts Added selection inheritance logic for lazy-loaded children
packages/components/tree/src/flat-tree-data-source.ts Added selection inheritance logic for lazy-loaded children
packages/components/tree/src/nested-tree-data-source.spec.ts Added comprehensive test suite for lazy loading with selection state
packages/components/tree/src/flat-tree-data-source.spec.ts Added comprehensive test suite for lazy loading with selection state
packages/components/tree/src/tree.stories.ts Enabled multiple selection in LazyLoad story
.changeset/legal-symbols-build.md Added changeset describing the fix

@jpzwarte jpzwarte merged commit 1d21347 into main Oct 29, 2025
18 of 20 checks passed
@jpzwarte jpzwarte deleted the fix/2806-tree-lazy-load-selection-state branch October 31, 2025 09:34
@github-actions github-actions bot mentioned this pull request Oct 28, 2025
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.

[Tree] Lazy loaded tree nodes are not selected

3 participants