Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Test to see how fuse feels #732

Merged
merged 3 commits into from
Mar 3, 2017
Merged

Test to see how fuse feels #732

merged 3 commits into from
Mar 3, 2017

Conversation

lukebarnard1
Copy link
Contributor

@lukebarnard1 lukebarnard1 commented Mar 2, 2017

@ara4n and I discussed that it would be a good idea to see how fuse feels on /develop.

This splits #724
and fixes element-hq/element-web#2934

Luke Barnard added 2 commits February 23, 2017 09:03
- Use avatar initial instead of "R" or "?"
- Use Fuse.js to do case-insensitive fuzzy search. This allows for better sorting of results as well as search based on weighted keys (so userId has a high weight when the input starts with "@").
- Added debounce of 200ms to prevent analysis on every key stroke. Fuse seems to degrade performance vs. simple, non-fuzzy, unsorted matching, but the debounce should prevent too much computation.
- Move the selection to the top when the query is changed. There's no point in staying mid-way through the items at that point.
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise lgtm

@@ -85,6 +86,21 @@ module.exports = React.createClass({
// Set the cursor at the end of the text input
this.refs.textinput.value = this.props.value;
}
// Create a Fuse instance for fuzzy searching this._userList
if (!this._fuse) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would there ever be a _fuse at mount time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the component gets unmounted and then mounted again(?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"R" logo when searching for users is ugly
2 participants