mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-12 04:20:28 +00:00
Fix broken config switch in demo (#20971)
This commit is contained in:
@@ -19,15 +19,15 @@ export const mockLovelace = (
|
||||
hass.mockWS("lovelace/resources", () => Promise.resolve([]));
|
||||
};
|
||||
|
||||
customElements.whenDefined("hui-view").then(() => {
|
||||
customElements.whenDefined("hui-card").then(() => {
|
||||
// eslint-disable-next-line
|
||||
const HUIView = customElements.get("hui-view");
|
||||
const HUIView = customElements.get("hui-card");
|
||||
// Patch HUI-VIEW to make the lovelace object available to the demo card
|
||||
const oldCreateCard = HUIView!.prototype.createCardElement;
|
||||
const oldCreateCard = HUIView!.prototype.createElement;
|
||||
|
||||
HUIView!.prototype.createCardElement = function (config) {
|
||||
HUIView!.prototype.createElement = function (config) {
|
||||
const el = oldCreateCard.call(this, config);
|
||||
if (el.tagName === "HA-DEMO-CARD") {
|
||||
if (config.type === "custom:ha-demo-card") {
|
||||
(el as HADemoCard).lovelace = this.lovelace;
|
||||
}
|
||||
return el;
|
||||
|
||||
Reference in New Issue
Block a user