Remember filter between navigation (#11565)

This commit is contained in:
Bram Kragten 2022-02-06 23:26:42 +01:00 committed by GitHub
parent 9be5a15c77
commit 04668ad809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 3 deletions

View File

@ -571,6 +571,9 @@ export class HaDataTable extends LitElement {
}
private _handleSearchChange(ev: CustomEvent): void {
if (this.filter) {
return;
}
this._debounceSearch(ev.detail.value);
}

View File

@ -234,6 +234,9 @@ export class HaTabsSubpageDataTable extends LitElement {
}
private _handleSearchChange(ev: CustomEvent) {
if (this.filter === ev.detail.value) {
return;
}
this.filter = ev.detail.value;
fireEvent(this, "search-changed", { value: this.filter });
}

View File

@ -67,7 +67,7 @@ export class HaConfigDeviceDashboard extends LitElement {
@state() private _showDisabled = false;
@state() private _filter = "";
@state() private _filter: string = history.state?.filter || "";
@state() private _numHiddenDevices = 0;
@ -490,6 +490,7 @@ export class HaConfigDeviceDashboard extends LitElement {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
history.replaceState({ filter: this._filter }, "");
}
private _clearFilter() {

View File

@ -109,7 +109,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
@state() private _showReadOnly = true;
@state() private _filter = "";
@state() private _filter: string = history.state?.filter || "";
@state() private _numHiddenEntities = 0;
@ -711,6 +711,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
history.replaceState({ filter: this._filter }, "");
}
private _handleSelectionChanged(

View File

@ -137,7 +137,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
window.location.hash.substring(1)
);
@state() private _filter?: string;
@state() private _filter: string = history.state?.filter || "";
@state() private _diagnosticHandlers?: Record<string, boolean>;
@ -613,6 +613,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
history.replaceState({ filter: this._filter }, "");
}
private async _highlightEntry() {