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

refactor: reduce item renderer calls in combo box #8173

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

sissbruecker
Copy link
Contributor

@sissbruecker sissbruecker commented Nov 19, 2024

Replaces calls to ComboBoxMixin.requestContentUpdate with calling requestContentUpdate on the scroller, which avoids additional item renderer calls after the scroller has already updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7044 introduced a number of requestContentUpdate calls for several scenarios:

  • Clear cache
  • Change size
  • Page loads

With that, the component now effectively runs ComboBoxMixin.requestContentUpdate three times when filtering using a data provider. Previously the method wasn't run at all and only the scroller would update.

But ComboBoxMixin.requestContentUpdate, in addition to updating the scroller, also runs renderers for all items again. So that results in three additional renderer calls for each item, for each filter change, when using a data provider.

Before the change

after.mov

After the change

before.mov

It looks like we can optimize that to only run requestContentUpdate on the scroller instead. I guess the question is then if there is any logic in data provider mixin that could cause an item's data to be updated, instead of the whole item reference, in which case this optimization would probably break something.

@sissbruecker sissbruecker marked this pull request as ready for review November 20, 2024 06:49
@sissbruecker sissbruecker changed the title chore: reduce item renderer calls in combo box refactor: reduce item renderer calls in combo box Nov 20, 2024
Copy link

sonarcloud bot commented Nov 20, 2024

@web-padawan web-padawan merged commit 0f88392 into main Nov 20, 2024
9 checks passed
@web-padawan web-padawan deleted the chore/combo-box-reduce-renderer-calls branch November 20, 2024 13:55
web-padawan pushed a commit that referenced this pull request Nov 20, 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.

4 participants