Do not fire command if we know component not loaded (#2875)

This commit is contained in:
Paulus Schoutsen 2019-03-03 10:26:10 -08:00 committed by GitHub
parent 34c6356a47
commit 241d7345d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ import {
deleteCloudhook, deleteCloudhook,
CloudWebhook, CloudWebhook,
} from "../../../data/cloud"; } from "../../../data/cloud";
import { ERR_UNKNOWN_COMMAND } from "../../../data/websocket_api";
declare global { declare global {
// for fire event // for fire event
@ -196,15 +195,10 @@ export class CloudWebhooks extends LitElement {
} }
private async _fetchData() { private async _fetchData() {
try { this._localHooks =
this._localHooks = await fetchWebhooks(this.hass!); "webhook" in this.hass!.config.components
} catch (err) { ? await fetchWebhooks(this.hass!)
if (err.code === ERR_UNKNOWN_COMMAND) { : [];
this._localHooks = [];
} else {
throw err;
}
}
} }
private renderStyle() { private renderStyle() {