Don't throw errors in card picker (#6188)

This commit is contained in:
Bram Kragten
2020-06-19 01:26:31 +02:00
committed by GitHub
parent 16c604937e
commit cf68f25a03
3 changed files with 60 additions and 18 deletions

View File

@@ -14,6 +14,7 @@ import "../cards/hui-weather-forecast-card";
import {
createLovelaceElement,
getLovelaceElementClass,
tryCreateLovelaceElement,
} from "./create-element-base";
const ALWAYS_LOADED_TYPES = new Set([
@@ -52,6 +53,17 @@ const LAZY_LOAD_TYPES = {
picture: () => import("../cards/hui-picture-card"),
};
// This will not return an error card but will throw the error
export const tryCreateCardElement = (config: LovelaceCardConfig) =>
tryCreateLovelaceElement(
"card",
config,
ALWAYS_LOADED_TYPES,
LAZY_LOAD_TYPES,
undefined,
undefined
);
export const createCardElement = (config: LovelaceCardConfig) =>
createLovelaceElement(
"card",