DBuit / sidebar-card

406 stars 39 forks source link

Cannot read properties of null (reading 'map') #53

Closed jeroomdm closed 10 months ago

jeroomdm commented 2 years ago

ERROR (MainThread) [frontend.js.latest.202112290] https://xxxxxxx.duckdns.org:8123/hacsfiles/sidebar-card/sidebar-card.js?hacstag=2418255740184:462:5343 Uncaught TypeError: Cannot read properties of null (reading 'map')

I always get this error in my logfiles. Is this a known error?

ry8s commented 2 years ago

I get the same

ERROR (MainThread) [frontend.js.latest.202204050] http://xx.xx.xx.xx/hacsfiles/sidebar-card/sidebar-card.js:462:5343 Uncaught TypeError: Cannot read properties of null (reading 'map')

marcocunha commented 1 year ago

+1 here using HA 2022.12.9: 2023-01-11 15:22:06.523 ERROR (MainThread) [frontend.js.latest.202212131] https://xx.xx.xx.xx/hacsfiles/sidebar-card/sidebar-card.js?hacstag=2418255740184:462:5343 Uncaught TypeError: Cannot read properties of null (reading 'map')

KentuckyMC commented 1 year ago

For the ones with this issue. I just debugged a bit, and seems that if you've empty template (so with some if checks etc.) and bottomline you don't have any matching condition, if your result is an empty string. It can't do the .map function on an empty string.

Temp fix for this, is just adding 1 line at the bottom of your template to always have at least 1

  • you give there:

    <li> </li>

  • marcocunha commented 1 year ago

    @KentuckyMC this workaround worked for me. Thanks