Entity Picker: undo fuzzy algorithm (#7360)

This commit is contained in:
Zack Barett 2020-10-16 09:45:58 -05:00 committed by GitHub
parent 7251e802ab
commit c268f42851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
import { computeDomain } from "../../common/entity/compute_domain";
import { computeStateName } from "../../common/entity/compute_state_name";
import { fuzzySequentialMatch } from "../../common/string/sequence_matching";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
import "../ha-svg-icon";
@ -266,12 +265,12 @@ export class HaEntityPicker extends LitElement {
}
}
private _filterChanged(ev): void {
(this._comboBox as any).filteredItems = this._states.filter((state) =>
fuzzySequentialMatch(ev.detail.value, [
state.entity_id,
computeStateName(state),
])
private _filterChanged(ev: CustomEvent): void {
const filterString = ev.detail.value.toLowerCase();
(this._comboBox as any).filteredItems = this._states.filter(
(state) =>
state.entity_id.toLowerCase().includes(filterString) ||
computeStateName(state).toLowerCase().includes(filterString)
);
}