Giter Club home page Giter Club logo

Comments (3)

dnguyen800 avatar dnguyen800 commented on June 2, 2024

I tested your change but it caused a crash. Can you double-check that this change works on your end?

from air-visual-card.

artospaj avatar artospaj commented on June 2, 2024

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 πŸ™„
See here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
Maybe that's the reason?

from air-visual-card.

dnguyen800 avatar dnguyen800 commented on June 2, 2024

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

from air-visual-card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.