-
Notifications
You must be signed in to change notification settings - Fork 191
fix: Avoid removing out-of-viewport items from cache #23141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+65
−53
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
397f9c7 to
c42587b
Compare
Test Results1 307 files ±0 1 307 suites ±0 1h 14m 36s ⏱️ +45s Results for commit 02d3c71. ± Comparison against base commit 3d0f854. This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
tltv
requested changes
Jan 9, 2026
...data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java
Show resolved
Hide resolved
|
tltv
approved these changes
Jan 12, 2026
vaadin-bot
pushed a commit
that referenced
this pull request
Jan 12, 2026
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
added a commit
that referenced
this pull request
Jan 12, 2026
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 Co-authored-by: Sergey Vinogradov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



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 toKeyMapperto allowHierarchicalDataCommunicatorto get all items that have keys and clean up those that are no longer in the viewport. SinceKeyMapperalways contains fewer items than theCache, this API helps reduce the number of iterations needed during cleanup.Fixes vaadin/flow-components#8427.
Type of change