Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/dialogs/quick-bar/ha-quick-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class QuickBar extends LitElement {

@internalProperty() private _filter = "";

@internalProperty() private _search = "";

@internalProperty() private _opened = false;

@internalProperty() private _commandMode = false;
Expand All @@ -79,6 +81,7 @@ export class QuickBar extends LitElement {
this._done = false;
this._focusSet = false;
this._filter = "";
this._search = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

Added this so the previous filter would clear before launching the dialog again.

this._commandTriggered = -1;
this._items = [];
fireEvent(this, "dialog-closed", { dialog: this.localName });
Expand Down Expand Up @@ -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}
>
Expand Down Expand Up @@ -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;
Expand Down