#1606: fixes TableRowExpanderColumn display/cache bug#1607
Merged
Conversation
…odes were removed from expandedNodeCache (expandedNodeCache.remove(getBean())) everytime a row was collapsed. This meant that ExpandableTableRowSkin's tableRow.itemProperty() listener was was getting null from the cache, and unable to remove the children, to clean-up the row. This problem went unnoticed until now because a table refresh was re-creating all cells anyway. Now though, there are optimisations in TableView which means these leftover nodes are visible / never cleaned up.
Maran23
approved these changes
Nov 24, 2025
There was a problem hiding this comment.
This looks correct! Removing the expanded node when the item changed is the correct approach here.
This should also improve the performance a bit since we are not eagerly removing the node from the cache anymore (on every collapse) - just when we need to - that is when the item changed. Therefore, we are also not recreating the same expanded node more often then we need to.
credmond
commented
Nov 25, 2025
| @Override | ||
| protected void invalidated() { | ||
| getTableView().refresh(); | ||
| if (!getValue()) expandedNodeCache.remove(getBean()); |
Contributor
Author
There was a problem hiding this comment.
Removing this from the cache here meant it's not available later, in the skin.
credmond
commented
Nov 25, 2025
| tableRow.itemProperty().addListener((observable, oldValue, newValue) -> { | ||
| if (oldValue != null) { | ||
| Node expandedNode = this.expander.getExpandedNode(oldValue); | ||
| Node expandedNode = this.expander.removeExpandedNode(oldValue); |
Contributor
Author
There was a problem hiding this comment.
Without the fix in place, expandedNode may be null and therefore never removed from the row.
abhinayagarwal
approved these changes
Dec 6, 2025
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
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.
Fixes #1606
Existing behaviour never worked as expected, nodes were removed from expandedNodeCache (expandedNodeCache.remove(getBean())) everytime a row was collapsed.
This meant that ExpandableTableRowSkin's tableRow.itemProperty() listener was was getting null from the cache, and unable to remove the children, to clean-up the row.
This problem went unnoticed until now because a table refresh was re-creating all cells anyway, so the un-removed nodes were getting discarded anyway. Now though, there are new optimisations in TableView which means these leftover nodes are visible as they're never never cleaned up from the rows.
The fix is to clean them up as I believe was originally intended.