custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.96k stars 240 forks source link

Button card with custom_fields disappear when refreshing the page #836

Open mitsu98 opened 8 months ago

mitsu98 commented 8 months ago

Checklist

Describe the bug Button card with custom_fields disappear when refreshing the page HA 2024.3.0

To Reproduce This is the configuration I used:

views:
  - title: Home
    cards:
      - type: custom:button-card
        name: Test
        label: Test
        custom_fields:
          camera:
            card:
              type: picture
              image: https://demo.home-assistant.io/stub_config/t-shirt-promo.png
    theme: Metro Slate
    path: home
    subview: false
button-card.js?hacstag=146194325412:426  TypeError: Cannot read properties of undefined (reading 'style')
    at button-card.js?hacstag=146194325412:426:18867
    at Ti._createCard (button-card.js?hacstag=146194325412:426:19038)
    at button-card.js?hacstag=146194325412:445:213
    at Array.forEach (<anonymous>)
    at Ti._buildCustomFields (button-card.js?hacstag=146194325412:445:30)
    at Ti._gridHtml (button-card.js?hacstag=146194325412:524:25)
    at Ti._buttonContent (button-card.js?hacstag=146194325412:506:454)
    at Ti._cardHtml (button-card.js?hacstag=146194325412:486:18)
    at Ti.render (button-card.js?hacstag=146194325412:426:19509)
    at Ti.update (button-card.js?hacstag=146194325412:1:14818)
button-card.js?hacstag=146194325412:426  Uncaught (in promise) TypeError: e.setConfig is not a function
    at Ti.render (button-card.js?hacstag=146194325412:426:19640)
    at Ti.update (button-card.js?hacstag=146194325412:1:14818)
    at Ti.performUpdate (button-card.js?hacstag=146194325412:1:6145)
    at Ti.scheduleUpdate (button-card.js?hacstag=146194325412:1:5792)
    at Ti._$Ej (button-card.js?hacstag=146194325412:1:5700)

Screenshots vid (1)

Rainerlan commented 7 months ago

Same for me - I'll delete my bug-ticket...

ablohm commented 7 months ago

I also have this issue. This is killing my dashboard.

kizovinh commented 7 months ago

Same for me, the card sometime doesn't show up, I have to refresh several times until it come. If open chrome dev tools, it will never come

bendiksolheim commented 6 months ago

I have the same problem. Unsure what’s causing it, but the error is more or less the same.

My dashboard has several views/tabs. If I refresh the tab with this exact card on, I get an error. If a different view/tab is active, I can refresh and switch to the troubling view/tab and everything is fine. This makes me think there is some timing issue.

EDIT: I believe I have narrowed it down to the picture card specifically. It may be a problem with other cards as well, but I managed to get entity cards and sensor cards working without this error. Switching the card back to a picture card immediately gives me the error again. Also, it does not matter how I reference the image. I have tried images served from HA, served from a different URL, and data URIs. They all give the same error.

mark007 commented 4 months ago

Have you been able to check this one @RomRider . I see a few old bugs / forum posts regarding it and it seemed to have been fixed at the time, I assume with some logic to wait for the required dependencies to be ready. If I shift+F5 on chrome, I almost never see it, but see it probably 50% of the time if I don't hold down shift.

It only started to repeatedly happen for me today when I moved about some elements in my dashboard, to be within the new homeassistant sections, so it does seem like wrapping button-cards within other elements can sometimes hide the issue, and wrapping it inside other things, exposes it somehow.

dfsworld commented 3 months ago

Please, same here,

Hankanman commented 2 months ago

same issue here, seems to effect the first card on the page with nested custom_fields

nurtext commented 2 days ago

Having this issue as well - any ideas on how to fix?