bramkragten / swipe-card

Card that allows you to swipe throught multiple cards for Home Assistant Lovelace
245 stars 36 forks source link

Avoid to rebuild the card on _hass state change #14

Closed RomRider closed 4 years ago

RomRider commented 4 years ago

The card was completely rebuild every time an entity was updated in HA. This avoids it and the interface is now way more snappier when using this card.

RomRider commented 4 years ago

Last commit is a bit dirty, but I didn't find a way to update the swiper once all the cards are built. On a full refresh (Command + R), swiper was not assigning the proper classes to the children because they where not yet built completely rendered. Updating the swiper 1sec after its initialisation seems to fix the issue but it's not optimal.

RomRider commented 4 years ago

I've pushed some new changes with resizeObserver that seem to work pretty well.

RomRider commented 4 years ago

+ new option to reset to it's initial position and documentation update :)

bramkragten commented 4 years ago

Looks good! Can we move reset after to a new PR?

pgorod commented 1 year ago

Hi. I'm having trouble with _rebuildCard (Uncaught (in promise) TypeError: this.createCardElement is not a function), I wonder if it is related to this?

Full exception text and some explanations available here. I posted in the forums but I fear this is too technical for the people there...

Thanks in advance for any assistance you may provide.