question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React-select is slow when you have more than 1000 items

See original GitHub issue

Low performance on large sets of options

React-select slows down when you have a huge array of data. Mouse screenshot 2018-10-19 at 15 29 43 screenshot 2018-10-19 at 15 51 21

FPS drops so low on mouseover, that i can barely use it. In my real case, where i have 1010 items, which i need to show(and i can’t load them as user types) - i cannot do anything at all.

You can find a simple example in codesandbox.

https://codesandbox.io/s/q8l6xnvz7w

[Violation] 'mouseover' handler took 346ms
[Violation] 'mouseover' handler took 184ms
[Violation] 'mouseover' handler took 197ms
[Violation] 'mouseover' handler took 172ms
[Violation] 'mouseover' handler took 161ms
[Violation] 'mouseover' handler took 150ms
[Violation] 'mouseover' handler took 167ms
[Violation] 'mouseover' handler took 172ms
[Violation] 'mouseover' handler took 156ms
[Violation] 'mouseover' handler took 166ms

React-select version: 2.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:99
  • Comments:82 (1 by maintainers)

github_iconTop GitHub Comments

60reactions
M1K3Yiocommented, Oct 19, 2018

Two things to look into that may help with your issues, we also had some issues regarding large lists.

filterOption={createFilter({ignoreAccents: false})}

Take a look at this reported bug https://github.com/JedWatson/react-select/issues/2850

There’s two examples using React-Window, which greatly improves the performance.

https://codesandbox.io/s/lxv7omv65l

48reactions
johnnyreillycommented, Apr 27, 2019

If it’s the typing lag that you’re bumping on (I was) then it’s actually the filterOption={createFilter({ignoreAccents: false})} suggestion by @M1K3Yio that’s the gem.

Using this massively reduces the lag when you’re typing into the select. I’ve got a sandbox here that illustrates: https://codesandbox.io/s/zn70lqp31m?fontsize=14

And I’ve blogged it too

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize your react-select component to smoothly ... - Botsplash
React -select is one of the most popular libraries for dropdown components. It offers solid rendering and filtering for hundreds of options, ...
Read more >
Efficiently rendering large list of data in React Select
I would implement lazy loading and add to the dropdown when user scroll to the bottom of the dropdown. React will only render...
Read more >
Improve the performance of dropdown containing large data ...
Now, let us consider a dropdown that has more than 1000+ options to be loaded. Loading complete data at once. import React, {...
Read more >
Optimize your react-select component to smoothly ... - Medium
React -select is one of the most popular libraries for dropdown ... or so items, you can start to feel a bit of...
Read more >
Rendering large lists in React: 5 methods with examples
Lists are an integral part of most web applications because they help ... of data that's causing the lag, but the rendered DOM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found