mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Exp. UI: add errorHandling for CustomElement and getCardSize() (#1295)
* Exp. UI: add errorHandling for CustomElement and getCardSize() * Add ";" * Lint
This commit is contained in:
parent
d2eb0ef23f
commit
449751c59f
@ -102,6 +102,10 @@ class HUIView extends PolymerElement {
|
||||
// eslint-disable-next-line
|
||||
console.error('Unknown type encountered:', cardConfig.type);
|
||||
continue;
|
||||
} else if (!customElements.get(tag)) {
|
||||
// eslint-disable-next-line
|
||||
console.error('Custom element doesn\'t exist:', tag);
|
||||
continue;
|
||||
}
|
||||
const element = document.createElement(tag);
|
||||
element.config = cardConfig;
|
||||
@ -152,8 +156,10 @@ class HUIView extends PolymerElement {
|
||||
return minIndex;
|
||||
}
|
||||
|
||||
elements.forEach(el =>
|
||||
columns[getColumnIndex(el.getCardSize())].push(el));
|
||||
elements.forEach((el) => {
|
||||
const cardSize = typeof el.getCardSize === 'function' ? el.getCardSize() : 1;
|
||||
columns[getColumnIndex(cardSize)].push(el);
|
||||
});
|
||||
|
||||
// Remove empty columns
|
||||
columns = columns.filter(val => val.length > 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user