-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] getting slow when loading 2000 options #17001
Comments
That's to be expected. You need to use a virtualisation solution, perhaps following this example: https://material-ui.com/components/lists/#virtualized-list |
@mbrookes with a usual virtualisation solution we'll lose full keyboard interactivity. For example, we'll not be able to type an option's text to move the focus. Is it possible to tweak something and have full keyboard interactivity with a virtualisation solution? |
You might have to use the native select in that case: https://material-ui.com/components/selects/#native-select |
Thanks for adding as Enhancement, we are waiting for upcoming release. @mbrookes : By using native-select, options will not come in material design but we are expecting the performance in material-ui-select. |
It's one of the reasons why I prefer This applies essentially to all collection widgets (trees, lists and grids). I'll take a look at the current keyboard a11y implementation and how you would add virtualization to Select. |
Hi @eps1lon, did you have the time to checkout the implementation of virtualization to Select (either using React-Window or React-Virtualized). My problem is pretty similar to this post here: |
Sorry, I didn't have time for it. Doesn't look like I will have bandwidth for this during OSS time in the near future. |
virtualization is good, but anyway concerning with overhead in performance
the difference in execution time is 6-7 times. |
Will this ever be fixed? Ive researched around and the only solutions seem to be using virtualization with Autocomplete, which is not a Select (and Ive tried to make the Autocomplete work as a select by disabling typing, but could not make it work), so its really not a solution. |
@UnderTheMoonspell we might rebuild the select to solve this and a dozen other issues we have with the component. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So basically there's no way to integrate any virtualization solution with non-native Select component? I am not asking about |
@oliviertassinari Hello! Are there any updates on this issue? Regarding of virtualization in Select component specifically. |
For anyone looking into this further, the issue is the following:
You can get a high performance and functional list with no styles by replacing MenuItemRoot in MenuItem.js. const MenuItemRoot = /*#__PURE__*/React.forwardRef(function MenuItemRoot({ focusVisibleClassName, ownerState, ...props }, ref) {
if(props.component.render){
return props.component.render(props);
}
return React.createElement("li", { ref, ...props });
}); ** It requires implementing your own styles, theming, closing the menu. But the focus and scrolling works as expected and it is high performance. If the maintainers are open to it I can expand on the above and open a PR with a MenuItemUnStyled or something similar. Video of the existing MenuItem with 2000 rows. Video of MenuItem after the changes above. |
Current Behavior 😯
Expected Behavior 🤔
Need to be fast on showing the drop-down and selecting the value
Steps to Reproduce 🕹
https://codesandbox.io/s/material-demo-5ygxr
Your Environment 🌎
The text was updated successfully, but these errors were encountered: