thomasloven / lovelace-card-mod

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

Performance warning is always showing on 2023.4.0b5 #267

Open kulmegil opened 1 year ago

kulmegil commented 1 year ago

My Home Assistant version: 2023.4.0b5

My lovelace configuration method (GUI or yaml): gui

What I am doing: loading tab

What I expected to happen: Nothing. No bad performance warning in dev console when proper installation procedure is followed

What happened instead: Performance warning is always shown in dev console

Looks like function getResources() from helpers.ts is returning invalid output

Minimal steps to reproduce:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js

Error messages from the browser console: card-mod-performace-warning


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

ASNNetworks commented 1 year ago

Also on 2023.4.1

ildar170975 commented 1 year ago

Confirmed, 2023.4.0

nima-1102 commented 1 year ago

Also on 2023.4.5

acshef commented 1 year ago

Looks like https://github.com/thomasloven/lovelace-card-mod/blob/b8c48b925643389fea5b1c0185ad7e0cbbd2bb76/src/helpers.ts#L166 is trying to split each script tag's innerText on newline, but that's not how they're formatted anymore:

> document.querySelectorAll("script")[3].innerText.trim()
'import("/hacsfiles/lovelace-card-mod/card-mod.js");import("/local/custom_icons/custom_icons.js");import("/hacsfiles/iconset.js");'
ScottG489 commented 1 year ago

From debugging, I'm seeing roughly the same as you @acshef:

"/hacsfiles/lovelace-card-mod/card-mod.jsimport("/hacsfiles/iconset.js");"

Oddly no ;'s between the statements though. I wonder where those imports are coming from.

Ali229 commented 1 year ago

Still having this issue

johntdyer commented 1 year ago

Still seeing this issue

nima-1102 commented 1 year ago

+1

Home Assistant 2023.9.3 Supervisor 2023.09.2 Operating System 10.5 Frontend 20230911.0 - latest

nick-holmquist commented 1 year ago

+1 Home Assistant 2023.9.3 Supervisor 2023.09.2 Operating System 10.5 Frontend 20230911.0 - latest

Siroguh commented 11 months ago

Is this related to the poor performance as of late? A simple screen tilt triggers an update and brings the card-mod styles. (I'm sorry idk how to debug properly)

https://github.com/thomasloven/lovelace-card-mod/assets/1921626/9ba33d6b-d242-424f-81ae-de5ded60a01a