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: do not render hidden combo box items #8181

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

sissbruecker
Copy link
Contributor

@sissbruecker sissbruecker commented Nov 19, 2024

Since adding the data provider controller to combo box in #7044, the component now calls ComboBoxMixin.requestContentUpdate when filtering using a data provider. That method iterates over every item in the overlay, regardless whether visible or hidden, and runs its renderer function:

this._getItemElements().forEach((item) => {
item.requestContentUpdate();
});

That can lead to an issue in the Flow component when using component renderers:

  • Entering a filter can move an item's content element to a different item (for example the first one if there is only one match)
  • The item that originally contained the content element is then hidden and not updated - it still references the same data, and thus the same content element
  • Then we run the renderer function for the hidden item, and move the content element back to it
  • The result is that the visible item ends up being empty

This change fixes the issue by not running the renderer function for hidden items.

Fixes vaadin/flow-components#6810

@web-padawan web-padawan merged commit 5e0adc1 into main Nov 19, 2024
9 checks passed
@web-padawan web-padawan deleted the fix/combo-box-hidden-item-rendering branch November 19, 2024 11:53
web-padawan pushed a commit that referenced this pull request Nov 19, 2024
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.beta1 and is also targeting the upcoming stable 24.6.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.

Inconsistent Rendering Issue in ComboBox with Custom Renderer When pageSize is Larger Than the Item Count
5 participants