thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

fix: Skip state update when cards have not been initialized #75

Closed buffcode closed 2 years ago

buffcode commented 2 years ago

The cards from states are initialized async. The first state update can sporadically trigger before all cards have been initialized (maybe depending on the cards' complexity?).

When the state has been determined, no further state change is triggered (the reactive property state has correctly been set to the default value). But as the cards are not initialized yet, state-switch will display nothing (no-match), as it cannot find any card matching the state's value.

This PR leaves the state untouched, unless the cards have been fully initialized.

Fixes !61

thomasloven commented 2 years ago

Thanks!

RadianceNL commented 2 years ago

Nvm, cache issue....great job!