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