-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure getAttributes().status is always string (#702)
* chore: Reformat vacuum-card.ts * 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`.
- Loading branch information
1 parent
735c8fc
commit a25f254
Showing
1 changed file
with
19 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters