thomasloven / lovelace-card-mod

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

entities cards need extra refesh for theme to load correctly (using card-mod-theming) #183

Closed Mariusthvdb closed 1 week ago

Mariusthvdb commented 2 years ago

My Home Assistant version: 2022.4.0.dev20220226

My lovelace configuration method (GUI or yaml): Yaml Card-mod 3.2.1 installed via

frontend:
  themes: !include_dir_merge_named /config/frontend_themes

  extra_module_url:
    - /local/lovelace/resources/lovelace-card-mod/card-mod.js

What I am doing: related to https://github.com/home-assistant/frontend/issues/10988#issuecomment-1052134096

changing themes in Lovelace, and have card-mod-theme in place

What I expected to happen:

all cards changing theme

What happened instead:

when changing themes, entities cards need an extra refresh to load the new theme. A reload of the page solves this. Minimal steps to reproduce:

# The least amount of code possible to reproduce my error, having 

Dark blue:

  <<: &generic
    card-mod-theme: custom-header
# rest of these settings
# End of code

Error messages from the browser console:


with card-mod-theme line, needs reload for theme change on entities:

Feb-26-2022 16-51-41

without, direct theme change on all, including entities:

Feb-26-2022 16-54-25

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

tomlut commented 2 years ago

Similar issue? https://github.com/thomasloven/lovelace-card-mod/issues/163

Mariusthvdb commented 2 years ago

just tested this with the new 3.1.3 card-mod version and it seems fixed !

could it be this update made the difference here, or has something changed in HA Lovelace frontend?

tomlut commented 2 years ago

Sadly, not for me.

Mariusthvdb commented 2 years ago

aw thats too bad, just checked it again and can only say in any browser, including Safari (!) the themes change correctly.

Mariusthvdb commented 5 months ago

not sure if we still need this? I can no duplicate any longer. 2024.3 (beta) and all is ok. @tomlut Tom could you please check, Id rather close if it were for me

tomlut commented 5 months ago

Yeah it's still broken for me. If I have a view open when my theme changes from day to night or vice versa I get a weird combination of both that needs a page refresh to fix.

Mariusthvdb commented 5 months ago

Ive just noticed something like that during the current beta 2024.3.

However, to me that seems to be a core Theme issue, and in my case has nothing to do with card-mod.

I had set energy colors in the theme, and only half of the energy panel changed to those colors when reloading Theme. And also next. all without card-mod involved. see: https://discord.com/channels/330944238910963714/427516175237382144/1214339675339100241

Mariusthvdb commented 1 week ago

@tomlut Tom, any progress on the matter?

personally id like to close as not experiencing any more since posted above. now on 2024.8, I hope this is fixed for you too?

tomlut commented 1 week ago

I won't have time to update until the weekend. However at the moment it is very much still broken (2022.7).

tomlut commented 1 week ago

Just updated. It is still an issue on 2024.8 but honestly I don;t care. Close it if you want Marius. I'm going to be stripping out all my card-mod theming and just go with the plain core theme. Far too much hassle to keep it all working.

Mariusthvdb commented 1 week ago

ok, let me do that then, I really can't break it anymore, maybe there indeed is something in your specific theme-mods that is no longer functional.

Let me close, and if you find yourself wanting again, I can re-open.

cleaning up my own issues....