primereact icon indicating copy to clipboard operation
primereact copied to clipboard

TreeSelect filter performance too slow when user is typing

Open A-Posthuman opened this issue 8 months ago • 5 comments

Describe the bug

In my app, I have a TreeSelect with over 20k keys, and I've noticed when using the filter mode that when you type the first couple of characters to search for that the performance is very laggy. However after typing the first 3 or 4 characters it speeds up, as the number of selected nodes decreases dramatically, and becomes quite ok when the user has typed 5 or more characters or a word.

I've also seen other instances of TreeSelect components on the web (not PrimeReact ones, from other component providers) where the filter will wait a small configurable amount of time (milliseconds) while the user is typing the search term before the component attempts to do the filtering. This works a lot better in terms of performance, it allows the component to remain responsive to the user while typing, and by waiting until they've typed several characters and stopped typing then the filter search can be executed much faster since fewer tree nodes will be selected.

Could this slight change of adding a configurable delay before doing the filtering be implemented? Thanks!

Reproducer

No response

PrimeReact version

10.6.6

React version

18.x

Language

ES6

Build / Runtime

Vite

Browser(s)

All

Steps to reproduce the behavior

No response

Expected behavior

No response

A-Posthuman avatar Jun 11 '24 21:06 A-Posthuman