Skip to content

Commit b48a0ea

Browse files
committed
Fix Home Assistant custom card registry mutation
1 parent c43021d commit b48a0ea

8 files changed

Lines changed: 50 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 5.1.5 - 2026-05-02
4+
5+
Home Assistant Dashboard picker registry fix.
6+
7+
- Mutates the existing `window.customCards` array in place instead of replacing it, matching Home Assistant's picker implementation which imports and keeps the original array reference.
8+
39
## 5.1.4 - 2026-05-02
410

511
Stronger Home Assistant Dashboard picker registration.

LOCAL_DEPLOYMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Use only this runtime package folder in Home Assistant `www`:
1212

1313
Use only this Lovelace resource pattern:
1414

15-
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.4`
15+
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.5`
1616

1717
From now on, bump only the query version after `?v=`.
1818
Do not change the file name again unless there is a hard cache emergency.
@@ -29,14 +29,14 @@ Stable deploy target:
2929

3030
`dist/` should always be the latest approved install package.
3131

32-
## Current 5.1.4 Mapping
32+
## Current 5.1.5 Mapping
3333

3434
- Edit: `src/homeii-music-flow.js`
3535
- Review/share: `dist/`
3636
- Deploy to HA `www`: copy the full contents of `dist/` into `www/community/homeii-music-flow/`
3737
- Package includes: `homeii-music-flow.js`, `sendspin-js/`, `vendor/embla-carousel.umd.js`, `homeii-flow-logo.svg`
3838
- Lovelace type: `custom:homeii-music-flow`
39-
- Lovelace resource: `/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.4`
39+
- Lovelace resource: `/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.5`
4040

4141
## Cache Reset Rule
4242

@@ -48,7 +48,7 @@ If a new version is approved:
4848

4949
Example:
5050

51-
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.4`
51+
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.5`
5252

5353
## Foundation Note
5454

PUBLISHING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
- the HACS My Home Assistant button
2424
- the HACS download/install button
2525

26-
## 2. Create the 5.1.4 release
26+
## 2. Create the 5.1.5 release
2727

28-
- Create a Git tag named `v5.1.4`.
28+
- Create a Git tag named `v5.1.5`.
2929
- Create a GitHub release from that tag.
30-
- Title the release `5.1.4`.
31-
- Use the `5.1.4` section from `CHANGELOG.md` as the release notes.
30+
- Title the release `5.1.5`.
31+
- Use the `5.1.5` section from `CHANGELOG.md` as the release notes.
3232
- If you attach a release artifact, zip the contents of `dist/`; do not publish only a single JS file while the local Sendspin player and Embla swipe support are enabled.
3333

3434
## 3. Verify repository files after publishing
@@ -79,7 +79,7 @@ to:
7979

8080
Then load:
8181

82-
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.4`
82+
`/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.5`
8383

8484
## 7. Final pre-release smoke test
8585

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</p>
2323

2424
<p align="center">
25-
<a href="https://github.com/r11a/homeii-music-flow"><img alt="version" src="https://img.shields.io/badge/version-5.1.4-gold"></a>
25+
<a href="https://github.com/r11a/homeii-music-flow"><img alt="version" src="https://img.shields.io/badge/version-5.1.5-gold"></a>
2626
<img alt="Home Assistant" src="https://img.shields.io/badge/Home%20Assistant-Dashboard-41BDF5">
2727
<img alt="Music Assistant" src="https://img.shields.io/badge/Music%20Assistant-required-7C5CFF">
2828
<img alt="Sendspin" src="https://img.shields.io/badge/Sendspin-browser%20player-18B6FF">
@@ -49,6 +49,10 @@ HOMEii Flow started from my own daily use of Home Assistant and Music Assistant.
4949
- **Hebrew and RTL ready:** layout, labels, alignment, and interaction patterns are built for Hebrew as a first-class use case.
5050
- **Release-ready package:** HACS-ready `dist/` output includes the card, Sendspin files, Embla swipe support, and the brand asset.
5151

52+
## What's New In 5.1.5
53+
54+
- **Dashboard picker registry fix:** HOMEii Flow now mutates Home Assistant's existing `window.customCards` registry in place instead of replacing it, matching the way the HA picker imports and reads custom-card metadata.
55+
5256
## What's New In 5.1.4
5357

5458
- **Stronger Dashboard picker registration:** HOMEii Flow now refreshes its custom-card metadata after load and exposes picker config methods directly on the final card class for Home Assistant versions that do not reliably pick them up through inheritance.
@@ -122,7 +126,7 @@ If HACS does not add the resource automatically, add:
122126
3. Add this Dashboard resource:
123127

124128
```text
125-
/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.4
129+
/local/community/homeii-music-flow/homeii-music-flow.js?v=5.1.5
126130
```
127131

128132
4. Add the card:
@@ -700,7 +704,7 @@ npm run lint
700704
npm test
701705
```
702706

703-
Current packaged version: `5.1.4`
707+
Current packaged version: `5.1.5`
704708

705709
## Release Readiness
706710

dist/homeii-music-flow.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
_versionedAssetUrl(url) {
430430
const value = String(url || "").trim();
431431
if (!value || /^data:/i.test(value) || /[?&]v=/.test(value)) return value;
432-
const version = typeof HOMEII_CARD_VERSION === "string" ? HOMEII_CARD_VERSION : "5.1.4";
432+
const version = typeof HOMEII_CARD_VERSION === "string" ? HOMEII_CARD_VERSION : "5.1.5";
433433
return `${value}${value.includes("?") ? "&" : "?"}v=${encodeURIComponent(version)}`;
434434
}
435435

@@ -9685,9 +9685,9 @@ function ensureHaEditorComponents() {
96859685
} catch (_) {}
96869686
}
96879687

9688-
const HOMEII_CARD_VERSION = "5.1.4";
9689-
const HOMEII_BROWSER_EDITOR_TAG = "homeii-music-flow-browser-editor-v5140";
9690-
const HOMEII_MOBILE_EDITOR_TAG = "homeii-music-flow-editor-v5140";
9688+
const HOMEII_CARD_VERSION = "5.1.5";
9689+
const HOMEII_BROWSER_EDITOR_TAG = "homeii-music-flow-browser-editor-v5150";
9690+
const HOMEII_MOBILE_EDITOR_TAG = "homeii-music-flow-editor-v5150";
96919691

96929692
const HomeiiEditorLocale = Object.freeze({
96939693
isHebrewLanguageTag(value) {
@@ -12256,7 +12256,7 @@ if (!customElements.get(HOMEII_BROWSER_EDITOR_TAG)) {
1225612256
customElements.define(HOMEII_BROWSER_EDITOR_TAG, HomeiiBaseMusicEditor);
1225712257
}
1225812258

12259-
window.customCards = (window.customCards || []).filter((card) => card?.type !== "custom:homeii-music-flow");
12259+
if (!Array.isArray(window.customCards)) window.customCards = [];
1226012260

1226112261
class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
1226212262
constructor() {
@@ -29156,11 +29156,14 @@ if (!customElements.get("homeii-music-mobile-editor")) {
2915629156
}
2915729157

2915829158
function registerHomeiiDashboardCard() {
29159-
window.customCards = (window.customCards || []).filter((card) => (
29160-
card?.type !== "custom:homeii-music-flow"
29161-
&& card?.type !== "homeii-music-flow"
29162-
));
29163-
window.customCards.push({
29159+
const customCardsRegistry = Array.isArray(window.customCards) ? window.customCards : (window.customCards = []);
29160+
for (let index = customCardsRegistry.length - 1; index >= 0; index -= 1) {
29161+
const card = customCardsRegistry[index];
29162+
if (card?.type === "custom:homeii-music-flow" || card?.type === "homeii-music-flow") {
29163+
customCardsRegistry.splice(index, 1);
29164+
}
29165+
}
29166+
customCardsRegistry.push({
2916429167
type: "homeii-music-flow",
2916529168
name: "HOMEii Flow",
2916629169
description: `Premium Music Assistant dashboard card v${HOMEII_CARD_VERSION}`,

docs/qa-matrix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ This matrix is the release gate for the `4.9.x` stabilization cycle. Every relea
3232

3333
## Release Rule
3434

35-
- `5.1.4` is blocked by any known `P0` or `P1` bug in the matrix above.
35+
- `5.1.5` is blocked by any known `P0` or `P1` bug in the matrix above.
3636
- Cosmetic `P3` issues may ship only if they are documented and non-regressive.
3737
- Any regression found in one viewport/theme combination must be retested across the rest of the matrix after the fix lands.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "homeii-music-flow",
3-
"version": "5.1.4",
3+
"version": "5.1.5",
44
"description": "Premium Home Assistant Music Assistant dashboard card with a mobile-first visual player and built-in editor.",
55
"private": true,
66
"license": "MIT",

src/homeii-music-flow.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
_versionedAssetUrl(url) {
430430
const value = String(url || "").trim();
431431
if (!value || /^data:/i.test(value) || /[?&]v=/.test(value)) return value;
432-
const version = typeof HOMEII_CARD_VERSION === "string" ? HOMEII_CARD_VERSION : "5.1.4";
432+
const version = typeof HOMEII_CARD_VERSION === "string" ? HOMEII_CARD_VERSION : "5.1.5";
433433
return `${value}${value.includes("?") ? "&" : "?"}v=${encodeURIComponent(version)}`;
434434
}
435435

@@ -9685,9 +9685,9 @@ function ensureHaEditorComponents() {
96859685
} catch (_) {}
96869686
}
96879687

9688-
const HOMEII_CARD_VERSION = "5.1.4";
9689-
const HOMEII_BROWSER_EDITOR_TAG = "homeii-music-flow-browser-editor-v5140";
9690-
const HOMEII_MOBILE_EDITOR_TAG = "homeii-music-flow-editor-v5140";
9688+
const HOMEII_CARD_VERSION = "5.1.5";
9689+
const HOMEII_BROWSER_EDITOR_TAG = "homeii-music-flow-browser-editor-v5150";
9690+
const HOMEII_MOBILE_EDITOR_TAG = "homeii-music-flow-editor-v5150";
96919691

96929692
const HomeiiEditorLocale = Object.freeze({
96939693
isHebrewLanguageTag(value) {
@@ -12256,7 +12256,7 @@ if (!customElements.get(HOMEII_BROWSER_EDITOR_TAG)) {
1225612256
customElements.define(HOMEII_BROWSER_EDITOR_TAG, HomeiiBaseMusicEditor);
1225712257
}
1225812258

12259-
window.customCards = (window.customCards || []).filter((card) => card?.type !== "custom:homeii-music-flow");
12259+
if (!Array.isArray(window.customCards)) window.customCards = [];
1226012260

1226112261
class HomeiiMusicFlowBaseCard extends HomeiiBaseMusicCard {
1226212262
constructor() {
@@ -29156,11 +29156,14 @@ if (!customElements.get("homeii-music-mobile-editor")) {
2915629156
}
2915729157

2915829158
function registerHomeiiDashboardCard() {
29159-
window.customCards = (window.customCards || []).filter((card) => (
29160-
card?.type !== "custom:homeii-music-flow"
29161-
&& card?.type !== "homeii-music-flow"
29162-
));
29163-
window.customCards.push({
29159+
const customCardsRegistry = Array.isArray(window.customCards) ? window.customCards : (window.customCards = []);
29160+
for (let index = customCardsRegistry.length - 1; index >= 0; index -= 1) {
29161+
const card = customCardsRegistry[index];
29162+
if (card?.type === "custom:homeii-music-flow" || card?.type === "homeii-music-flow") {
29163+
customCardsRegistry.splice(index, 1);
29164+
}
29165+
}
29166+
customCardsRegistry.push({
2916429167
type: "homeii-music-flow",
2916529168
name: "HOMEii Flow",
2916629169
description: `Premium Music Assistant dashboard card v${HOMEII_CARD_VERSION}`,

0 commit comments

Comments
 (0)