mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Fix quickbar debounce (#7426)
* Fix quicbar debounce * Clear search property when dialog is closed Co-authored-by: Donnie <donniekarnsinsb@hotmail.com>
This commit is contained in:
parent
dbd53f8d14
commit
211ab4eea8
@ -55,6 +55,8 @@ export class QuickBar extends LitElement {
|
||||
|
||||
@internalProperty() private _filter = "";
|
||||
|
||||
@internalProperty() private _search = "";
|
||||
|
||||
@internalProperty() private _opened = false;
|
||||
|
||||
@internalProperty() private _commandMode = false;
|
||||
@ -79,6 +81,7 @@ export class QuickBar extends LitElement {
|
||||
this._done = false;
|
||||
this._focusSet = false;
|
||||
this._filter = "";
|
||||
this._search = "";
|
||||
this._commandTriggered = -1;
|
||||
this._items = [];
|
||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||
@ -116,7 +119,7 @@ export class QuickBar extends LitElement {
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.quick-bar.filter_placeholder"
|
||||
)}
|
||||
.filter=${this._commandMode ? `>${this._filter}` : this._filter}
|
||||
.filter=${this._commandMode ? `>${this._search}` : this._search}
|
||||
@keydown=${this._handleInputKeyDown}
|
||||
@focus=${this._setFocusFirstListItem}
|
||||
>
|
||||
@ -237,12 +240,14 @@ export class QuickBar extends LitElement {
|
||||
|
||||
if (newFilter.startsWith(">")) {
|
||||
this._commandMode = true;
|
||||
this._debouncedSetFilter(newFilter.substring(1));
|
||||
this._search = newFilter.substring(1);
|
||||
} else {
|
||||
this._commandMode = false;
|
||||
this._debouncedSetFilter(newFilter);
|
||||
this._search = newFilter;
|
||||
}
|
||||
|
||||
this._debouncedSetFilter(this._search);
|
||||
|
||||
if (oldCommandMode !== this._commandMode) {
|
||||
this._items = undefined;
|
||||
this._focusSet = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user