-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve search performance #1385
Conversation
This change applies a unique ID to each badge example, and uses that to key the DOM. Before this change, the key was the array index. While constant with the filter, it mutated as the filter changed, causing React to mutate the DOM very inefficiently. Badges were filtered out by mutating al the rows instead of simply removing the affected rows. I first tried a version that applied a class with `display: none` to the hidden elements. That worked; however the implementation has a bunch of indirection, and this works nearly as well.
Generated by 🚫 dangerJS |
Would appreciate some testing vs https://shields.io/ and https://shields-staging.herokuapp.com/! |
In my testing, https://shields.io/ is still faster, though https://shields-staging-pr-1385.herokuapp.com/ is much faster than https://shields-staging.herokuapp.com/. |
Yea, agreed, that isn't great. However I don't believe it would happen in production, where |
I pushed the other branch if you'd like to compare: #1393. |
Closing in favor of #1393. |
This change applies a unique ID to each badge example, and uses that to key the DOM.
Before this change, the key was the array index. While constant with the filter, it mutated as the filter changed, causing React to mutate the DOM very inefficiently. Badges were filtered out by mutating al the rows instead of simply removing the affected rows.
I first tried a version that applied a class with
display: none
to the hidden elements. That worked; however the implementation has a bunch of indirection, and this works nearly as well.Fix #1314