Closed artospaj closed 3 years ago
I tested your change but it caused a crash. Can you double-check that this change works on your end?
Hey @dnguyen800 , sorry I couldn't verify that once again because currently I'm doing a reconfiguration of my HA instance.
What I can say is that the fix I proposed just solved my problem. In my case the sensor.config
property was null
because I didn't pass on of sensors in Lovelace configuration.
Can you please give me some details of error and an use case to reproduce it? To be honest I'm a backend developer and I didn't care much about browser compatibility :roll_eyes: See here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining Maybe that's the reason?
I'm not a programmer and never actually learned Javascript (besides looking at other people's examples, so I have a lot of gaps in knowledge unfortunately...
What I wanted to understand was in this line of code (see below), you added a question mark '?', but I wasn't sure what it does. It's hard to search online for what a ? means in code, haha. I tried using the fix in my instance and it crashed the UI, though maybe I should double-check again if it works on your end.
if (sensor.config?.split('.')[0] == 'sensor')
I noticed hat bug in HA v108.9, I believe it existed before but didn't stop the rendering of the whole HA dashboard.
My Lovelace configuration for card:
As you can see there is no
air_pollution_level
sensor provided (it's optional in docs), but looking at the code if any of sensors is not provided, will make JS fail in the same place.(fix in the way, I'll reference this issue)