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

Select: scrolling to top of the options list after virtualization threshold is achieved #2022

Open
Sharzon opened this issue Dec 27, 2024 · 2 comments
Labels
bug Something isn't working component: Select

Comments

@Sharzon
Copy link

Sharzon commented Dec 27, 2024

When we are adding options at some moment we move through virtualization threshold. In this moment view scrolls to top of the options list. It looks strange in async selects, because we always load new pages of options.

Code to reproduce:
https://codesandbox.io/p/sandbox/s2jvw5

Video:
https://github.com/user-attachments/assets/394c7ced-93d5-4b00-b080-c627ae3244d2

@korvin89 korvin89 added component: Select bug Something isn't working labels Dec 27, 2024
@korvin89
Copy link
Contributor

cc @ValeraS I think we should get it in mind for new list component development

@VladislavkaK
Copy link

VladislavkaK commented Jan 15, 2025

@korvin89 as for me, the error comes from this expression already
const virtualized = filteredOptions.length >= virtualizationThreshold;
since it is obvious that the number of options will often be less than virtualizationThreshold and at the moment when the number of options becomes more than the virtualizationThreshold, it will cause the component to be rerender and this function will work
private renderItems() {
if (this.props.virtualized) {
return this.renderVirtualizedContainer();
} else {
return this.renderSimpleContainer();
}
}
I suggest passing the virtualized property for the Select component if we want to use onLoadMore or add a new ItemCount property where we will specify the total number of options, often the total number comes via the API.
through the itemCount was done, and in the material ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: Select
Projects
None yet
Development

No branches or pull requests

3 participants