Repository navigation
fix: avoid temporarily clearing the component renderer - #2621
Merged
Merged
Conversation
tomivirkki
commented
Feb 9, 2022
| import org.openqa.selenium.WebElement; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Locale; |
Member
Author
There was a problem hiding this comment.
Changes to GridDetailsRow tests are a cherry-pick of 57c2b3d and not directly related to this PR
web-padawan
approved these changes
Feb 9, 2022
web-padawan
left a comment
Member
There was a problem hiding this comment.
LGTM. The old logic is indeed confusing, it's better to only clear node once.
|
Kudos, SonarCloud Quality Gate passed!
|
vaadin-bot
pushed a commit
that referenced
this pull request
Feb 10, 2022
tomivirkki
added a commit
that referenced
this pull request
Feb 10, 2022
Collaborator
|
This ticket/PR has been released with platform 23.0.0.beta2 and is also targeting the upcoming stable 23.0.0 version. |
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 #2363
The
Virtualizer(also used by<vaadin-grid>) uses a nativeResizeObserverinternally to detect and react to item height changes; in the case ofGrid, it observes height changes on the body row (<tr>) elements. Typically it catches row height changes just fine and updates the row positions accordingly.In this specific case, a
<flow-component-renderer>on each row gets assigned a new element reference due to a dynamic data update, resulting in the old element getting removed and the new element getting added asynchronously.Between these events, (after clearing the content and before the new element gets asynchronously added), the
Gridrequests theVirtualizerto flush, resulting in the row positions getting recalculated with empty<flow-component-renderer>s in place (meaning, with reduced row height)After that, the new content is added and the row height increases back to what it was before. One could assume that the
ResizeObserverwould catch this change in height and fix the row positions. But while all this happens asynchronously, the height actually gets restored exactly to what it was and the delay is fast enough so that theResizeObserversimply ignores the temporary size change. As a result, the rows end up not getting re-measured and re-positioned with the proper content in place.This PR changes
flow-component-rendererso that it doesn't clear its content while waiting for the new element, but always usesreplaceChildif it includes a discarded child element beforehand.