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
Ensure getAttributes().status is always string #702
Conversation
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`.
Thanks for a fix! |
It appears this fixes the bug I created yesterday #714 can we get a release and do I need to close the bug to this PR? |
@denysdovhan I think you need to release a new version so it can be installed/upgraded trough HACS |
Yeah i was just about to post here that we need a release for people to get automated updates. |
No pressure, just putting something under attention which might have been overseen. Using a forked repository as a quick fix is not a sustainable solution imho, plenty of people will forget to revert back to the original repository once a new release is made and who's going to guarantee that the fork will be maintained? Better to just download the master zip file and upload the contents to the |
@rrooggiieerr It won't be maintained but it will exist at least until a fixed version will be released as I'm using it myself. I recommend everyone using it to subscribe to release notifications for this repo to know when to change it back. |
## [2.8.1](v2.8.0...v2.8.1) (2024-03-13) ### Bug Fixes * Ensure getAttributes().status is always string ([#702](#702)) ([a25f254](a25f254)) * remove some conditions for release ([7945494](7945494)) * Update hu.json ([#605](#605)) ([1a92e99](1a92e99)) * Update ru.json ([#602](#602)) ([733ce63](733ce63)) * Updates to Finnish (fi) translation ([#608](#608)) ([584e19f](584e19f))
🎉 This PR is included in version 2.8.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
After upgrading to Home Assistant 2024.2.4, vacuum-card didn't
render due to null reference. The error shown on the console:
Based on the types, both
status
andstate
attributes can be undefined,while the
state
on the entity itself always has a string value. By reorganizingthe return value of
getAttributes
, we ensure the derivedstatus
won't getoverwritten by an undefined
entity.attributes.status
.Fixes #699.
Aside: I had difficulty getting the actual change in a separate commit as the precommit hook reformatted the file every time. I've included the formatting in a separate commit. I noticed running
npm run format
would also format other files as well.