-
Notifications
You must be signed in to change notification settings - Fork 268
feat: Do not incur cost of filtering tree if search mode is off #580
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
Conversation
e57d4ef to
de56dfe
Compare
|
Tagging @mrchief |
|
As a temporary step, I ended up forking this package and publishing my own: https://www.npmjs.com/package/@gandhis1/react-dropdown-tree-select I then tested it in my main application and this fix works exactly as intended. 100k nodes across 10+ levels does not lock up when you have an empty string search term. |
|
@gandhis1 Thanks for sending this! This sounds like a great idea and I'll look into this soon. Been swamped at work lately |
|
Hi any update on this? It's a pretty tiny PR |
|
Sorry @gandhis1 Will do by end of the week |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
|
Following up, can this be reviewed? |
|
@gandhis1 I'm swamped at the moment but I plan on getting to this, along with the other stuff that's pending. Thanks for waiting. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
|
Posting to keep this from being stale, PR is awaiting review |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
|
Not stale |
mrchief
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay and thank for sending this
Co-authored-by: Siddhartha Gandhi <siddhartha.gandhi@centivacapital.com> Co-authored-by: Hrusikesh Panda <mrchief@users.noreply.github.com>
What does it do?
When you have tens of thousands of items in a search tree, and you type search input, the cost can be extremely high when you have zero or one characters, especially when you are using a custom search predicate. There is no need to incur the cost of filtering the tree if the text input is zero length. Instead, just reset the search state.
I'll note here that the example in the demo that is supposed to test a large-scale scenario doesn't appear to be all that taxing because the number of nested nodes is very low. You need a lot of nested nodes to encounter performance issues. In my testing, I have almost 100k nodes at up to 10 levels of nesting. I also have
keepTreeOnSearchon which probably exacerbates the issue.This is the first change I would like to do. In a future PR, my intention would be to set the threshold (search term length) at which the search activates. When your search term is "a" you can trigger rendering of thousands of nodes potentially. So this parameter I am envisioning would basically prevent search mode until X characters...with some kind of visual indicator.
Type of change
Please delete options that are not relevant.
Checklist: