Skip to content
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

fix: make virtualizer react to asynchronous item size increase #3907

Merged
merged 2 commits into from
May 21, 2022

Conversation

tomivirkki
Copy link
Member

@tomivirkki tomivirkki commented May 20, 2022

Part of vaadin/flow-components#3206

If a virtualizer child element has a height of 0 after an update, currently the Virtualizer would set min-height: 200px for it to avoid iron-list-core from generating an unlimited amount of elements while trying to cover the viewport.

The problem with min-height is that once the element content gets changed asynchronously (in the case of <flow-component-renderer> when the content component gets loaded and appended), the effective height of the element would not change (it would still remain 200 pixels high) and internal resizing logic would not invoke.

This PR changes the Virtualizer to use padding-top instead of min-height for the placeholder size so that once the content updates, the element's effective height will actually change, which in turn invokes the internal ResizeObserver.

NOTE: The initial revision of this PR used padding-bottom, but an inline padding-bottom style is already used by <vaadin-grid>'s row details -feature so it's not an option.

@tomivirkki tomivirkki marked this pull request as draft May 20, 2022 12:46
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tomivirkki tomivirkki marked this pull request as ready for review May 20, 2022 13:26
@tomivirkki tomivirkki requested a review from web-padawan May 20, 2022 13:27
@tomivirkki tomivirkki changed the title fix: make virtualizer react to dynamic item size increase fix: make virtualizer react to asynchronous item size increase May 20, 2022
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 23.1.0.rc1 and is also targeting the upcoming stable 23.1.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants