Skip to content

Conversation

@vaadin-bot
Copy link
Collaborator

This PR cherry-picks changes from the original PR #23141 to branch 25.0.

Original PR description

Description

The PR fixes a regression that was introduced in #22328. Removing items from the cache turned out to cause issues with the collapse(T item) method, which became unable to find such "unloaded" items and clean up their sub-caches if they were expanded.

While it's technically possible to refactor the collapse(T item) method so that it traverses the tree of sub-caches instead of relying on item contexts, reverting to not clearing the cache seems like the better option. It simplifies the implementation and restores the behavior to what it was in Vaadin 24, where items were removed from the key mapper but remained in the hierarchy mapper.

Note, as part of the fix, a new objects() method was added to KeyMapper to allow HierarchicalDataCommunicator to get all items that have keys and clean up those that are no longer in the viewport. Since KeyMapper always contains fewer items than the Cache, this API helps reduce the number of iterations needed during cleanup.

Fixes vaadin/flow-components#8427.

Type of change

  • Bugfix

Fixes a regression that was introduced in #22328. Removing items from the cache turned out to cause issues with the collapse(T item) method, which became unable to find such "unloaded" items and clean up their sub-caches if they were expanded.

Simplifies the implementation and restores the behavior to what it was in Vaadin 24, where items were removed from the key mapper but remained in the hierarchy mapper.

Note, as part of the fix, a new objects() method was added to KeyMapper to allow HierarchicalDataCommunicator to get all items that have keys and clean up those that are no longer in the viewport. Since KeyMapper always contains fewer items than the Cache, this API helps reduce the number of iterations needed during cleanup.

Fixes: vaadin/flow-components#8427
@vaadin-bot
Copy link
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR[Message is sent from bot]

@vaadin-bot vaadin-bot enabled auto-merge (squash) January 12, 2026 13:32
@sonarqubecloud
Copy link

@github-actions
Copy link

Test Results

1 310 files  1 310 suites   1h 17m 27s ⏱️
9 276 tests 9 208 ✅ 68 💤 0 ❌
9 732 runs  9 656 ✅ 76 💤 0 ❌

Results for commit 94d004b.

@vaadin-bot vaadin-bot merged commit c3c6665 into 25.0 Jan 12, 2026
30 checks passed
@vaadin-bot vaadin-bot deleted the cherry-pick-23141-to-25.0-1768224276217 branch January 12, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants