xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 9 forks source link

`Select` component should defend against overly-long list of options #3835

Open amcclain opened 1 week ago

amcclain commented 1 week ago

By default, the select component will render all of their options values, which can be a (potentially serious) performance issue as DOM elements are created for every one.

We have an enabledWindowed prop that is usable under certain circumstances - not async, not creatable - and will use a virtual rendering window to avoid this issue. But that prop is false by default, and again cannot be used in all cases.

The risk with the status quo is that a select might appear to behave very well in development or with some surrounding query that limits its options, but then if a long list of is unexpectedly presented, the rendering delay can be bad enough to freeze up the browser.