thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.04k stars 169 forks source link

Card-Mod errors when user visits /config/areas #367

Open kulmegil opened 3 months ago

kulmegil commented 3 months ago

My Home Assistant version: 2024.3.2

My lovelace configuration method (GUI or yaml): GUI (not relevant)

What I am doing: Opening "Areas & Zones" section in config

What I expected to happen: no errors

What happened instead:

Minimal steps to reproduce:

  1. open /config/areas

Error messages from the browser console:

NOTE: yep, this's not a mistake. Card-mod is attempting to bind to a ... string (equal to HA instance host) instead of html element. This is a result of Area config view containing <ha-card> elements being inside <a> links.

Card-mod is trying to retrieve shadow root's host element by taking .host property out of parent element. However since parent element is just a <a> element (without shadow DOM) then .host returns part of target url (string).

Uncaught (in promise) TypeError: can't assign to property "setConfig" on "homeassistant.local:8123": not an object
    patch_method card-mod.js:675
    patch_object card-mod.js:681
    firstUpdated card-mod.js:719
    fn card-mod.js:667
    _$AE reactive-element.ts:1376
    performUpdate reactive-element.ts:1343
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    C lit-element.ts:115
    F ha-card.ts:5

By putting an X in the boxes ([]) below, I indicate that I:

ildar170975 commented 3 months ago

I confirm errors in Code Inspector.