mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Fix supervisor not loading Firefox (#17146)
This commit is contained in:
parent
6a2cad1af3
commit
a3b87a6e7b
@ -23,6 +23,7 @@ import {
|
|||||||
SupervisorObject,
|
SupervisorObject,
|
||||||
supervisorCollection,
|
supervisorCollection,
|
||||||
SupervisorKeys,
|
SupervisorKeys,
|
||||||
|
cleanupSupervisorCollection,
|
||||||
} from "../../src/data/supervisor/supervisor";
|
} from "../../src/data/supervisor/supervisor";
|
||||||
import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
|
import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
|
||||||
import { urlSyncMixin } from "../../src/state/url-sync-mixin";
|
import { urlSyncMixin } from "../../src/state/url-sync-mixin";
|
||||||
@ -67,6 +68,10 @@ export class SupervisorBaseElement extends urlSyncMixin(
|
|||||||
this._unsubs[unsub]();
|
this._unsubs[unsub]();
|
||||||
delete this._unsubs[unsub];
|
delete this._unsubs[unsub];
|
||||||
});
|
});
|
||||||
|
Object.keys(this._collections).forEach((collection) => {
|
||||||
|
cleanupSupervisorCollection(this.hass.connection, collection);
|
||||||
|
});
|
||||||
|
this._collections = {};
|
||||||
this.removeEventListener(
|
this.removeEventListener(
|
||||||
"supervisor-collection-refresh",
|
"supervisor-collection-refresh",
|
||||||
this._handleSupervisorStoreRefreshEvent
|
this._handleSupervisorStoreRefreshEvent
|
||||||
@ -114,7 +119,9 @@ export class SupervisorBaseElement extends urlSyncMixin(
|
|||||||
private async _handleSupervisorStoreRefreshEvent(ev) {
|
private async _handleSupervisorStoreRefreshEvent(ev) {
|
||||||
const collection = ev.detail.collection;
|
const collection = ev.detail.collection;
|
||||||
if (atLeastVersion(this.hass.config.version, 2021, 2, 4)) {
|
if (atLeastVersion(this.hass.config.version, 2021, 2, 4)) {
|
||||||
|
if (collection in this._collections) {
|
||||||
this._collections[collection].refresh();
|
this._collections[collection].refresh();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,11 +136,17 @@ export class SupervisorBaseElement extends urlSyncMixin(
|
|||||||
if (this._unsubs[collection]) {
|
if (this._unsubs[collection]) {
|
||||||
this._unsubs[collection]();
|
this._unsubs[collection]();
|
||||||
}
|
}
|
||||||
this._unsubs[collection] = this._collections[collection].subscribe((data) =>
|
try {
|
||||||
|
this._unsubs[collection] = this._collections[collection].subscribe(
|
||||||
|
(data) =>
|
||||||
this._updateSupervisor({
|
this._updateSupervisor({
|
||||||
[collection]: data,
|
[collection]: data,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _initSupervisor(): Promise<void> {
|
private async _initSupervisor(): Promise<void> {
|
||||||
|
@ -132,3 +132,6 @@ export const getSupervisorEventCollection = (
|
|||||||
subscribeSupervisorEventUpdates(connection, store, key),
|
subscribeSupervisorEventUpdates(connection, store, key),
|
||||||
{ unsubGrace: false }
|
{ unsubGrace: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const cleanupSupervisorCollection = (conn: Connection, key: string) =>
|
||||||
|
delete conn[`_supervisor${key}Event`];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user