Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure getAttributes().status is always string #702

Merged
merged 2 commits into from
Mar 7, 2024

Commits on Feb 29, 2024

  1. Configuration menu
    Copy the full SHA
    2f291b2 View commit details
    Browse the repository at this point in the history
  2. fix: Reference to null status value on HA versions >=2024.2

    After upgrading to Home Assistant 2024.2.4, vacuum-card didn't
    render due to null reference. The error shown on the console:
    
        Uncaught (in promise) TypeError: Cannot read properties of null (reading 'toLowerCase')
            at qr.renderStatus (vacuum-card.js?hacstag=261291295280:4:14674)
            at qr.render (vacuum-card.js?hacstag=261291295280:4:17680)
            at qr.update (vacuum-card.js?hacstag=261291295280:1:15173)
            at qr.performUpdate (vacuum-card.js?hacstag=261291295280:1:6493)
            at qr.scheduleUpdate (vacuum-card.js?hacstag=261291295280:1:6140)
            at qr._$Ej (vacuum-card.js?hacstag=261291295280:1:6048)
    
    Based on the types, both `status` and `state` attributes can be undefined,
    while the `state` on the entity itself always has a string value. By reorganizing
    the return value of `getAttributes`, we ensure the derived `status` won't get
    overwritten by an undefined `entity.attributes.status`.
    ristomatti committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    182afbe View commit details
    Browse the repository at this point in the history