sidebar-card icon indicating copy to clipboard operation
sidebar-card copied to clipboard

Cannot read properties of null (reading 'map')

Open jeroomdm opened this issue 3 years ago • 1 comments

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?

jeroomdm avatar Jan 04 '22 15:01 jeroomdm

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')

ry8s avatar Apr 14 '22 14:04 ry8s

+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')

marcocunha avatar Jan 11 '23 15:01 marcocunha

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>

  • KentuckyMC avatar Feb 23 '23 18:02 KentuckyMC

    @KentuckyMC this workaround worked for me. Thanks

    marcocunha avatar Mar 02 '23 13:03 marcocunha