Skip to content

Commit

Permalink
Fix logbook card display/reloading issues (#21253)
Browse files Browse the repository at this point in the history
remove await logic
  • Loading branch information
silamon authored Jul 2, 2024
1 parent 7258e31 commit 7d432cd
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/panels/logbook/ha-logbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class HaLogbook extends LitElement {
this._throttleGetLogbookEntries.cancel();
this._updateTraceContexts.cancel();
this._updateUsers.cancel();
await this._unsubscribeSetLoading();
this._unsubscribeSetLoading();

if (force) {
this._getLogBookData();
Expand Down Expand Up @@ -206,18 +206,9 @@ export class HaLogbook extends LitElement {
);
}

private async _unsubscribe(): Promise<void> {
private _unsubscribe() {
if (this._subscribed) {
const unsub = await this._subscribed;
if (unsub) {
try {
await unsub();
} catch (e) {
// The backend will cancel the subscription if
// we subscribe to entities that will all be
// filtered away
}
}
this._subscribed.then((unsub) => unsub?.());
this._subscribed = undefined;
}
}
Expand All @@ -239,8 +230,8 @@ export class HaLogbook extends LitElement {
* Setting this._logbookEntries to undefined
* will put the page in a loading state.
*/
private async _unsubscribeSetLoading() {
await this._unsubscribe();
private _unsubscribeSetLoading() {
this._unsubscribe();
this._logbookEntries = undefined;
this._pendingStreamMessages = [];
}
Expand All @@ -249,8 +240,8 @@ export class HaLogbook extends LitElement {
* Setting this._logbookEntries to an empty
* list will show a no results message.
*/
private async _unsubscribeNoResults() {
await this._unsubscribe();
private _unsubscribeNoResults() {
this._unsubscribe();
this._logbookEntries = [];
this._pendingStreamMessages = [];
}
Expand Down

0 comments on commit 7d432cd

Please sign in to comment.