[autocomplete] renderOption is extremely slow
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Go to this sandbox: https://stackblitz.com/edit/react-nv8116-okqafc?file=demo.tsx
Steps:
- Have more than 500+ entries as Autocomplete options
- Expand the dropdown or start typing anything
- Observe the extreme lag on expand or when typing/deleting the first letter
Current behavior 😯
Extreme lag when Autocomplete is using renderOption with somewhat "large" entries.
Expected behavior 🤔
Expect it to not lag... or at least for things as little as under 1-2000 entries, it shouldn't be that bad.
Context 🔦
There is another ticket trying to resolve this issue but it looks like the changes to the virtualization never got merged into any release?
https://github.com/mui/material-ui/issues/25417
The merged fix seems to be only address the documentation (based on the title).
I don't think renderOption should be re-rendering everything from scratch on every operations (expand, keypress)?
Your environment 🌎
See sandbox.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz sandbox and its demo.tsx to reproduce the lag with 500+ Autocomplete options and renderOption. Read issue #25417 for the referenced virtualization context; done means expanding and typing or deleting in the dropdown no longer causes extreme lag for roughly 1,000–2,000 entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100