Skip to content

Commit cfca648

Browse files
authored
Merge pull request #754 from dcapslock/entities-card-row
fix: expander when used in masonry view may not toggle state.
2 parents 48021b9 + 9b694c1 commit cfca648

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Card.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ limitations under the License.
5252
}
5353
});
5454
$effect(() => {
55-
if (container) {
55+
if (container && preview !== undefined) {
5656
container.preview = preview;
5757
}
5858
});
@@ -62,7 +62,7 @@ limitations under the License.
6262
// card disabled config sets hui-card to correctly update its display
6363
cardConfig.disabled = !open;
6464
// eslint-disable-next-line no-underscore-dangle
65-
container._element?.dispatchEvent(new CustomEvent('card-visibility-changed'));
65+
container._element?.dispatchEvent(new CustomEvent('card-visibility-changed', { detail: { value: open }, bubbles: true, composed: false }));
6666
}
6767
});
6868
@@ -89,6 +89,11 @@ limitations under the License.
8989
el.style.setProperty('--ha-card-backdrop-filter', 'none');
9090
}
9191
92+
// eslint-disable-next-line svelte/no-dom-manipulating
93+
container.replaceWith(el);
94+
container = el;
95+
loading = false;
96+
9297
if (animation) {
9398
// Start with an estimated height.
9499
// Update with resize observer once we have the real height.
@@ -108,11 +113,6 @@ limitations under the License.
108113
});
109114
resizeObserver.observe(el);
110115
}
111-
112-
// eslint-disable-next-line svelte/no-dom-manipulating
113-
container.replaceWith(el);
114-
container = el;
115-
loading = false;
116116
});
117117
118118
</script>

src/ExpanderCard.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
showButtonUsers = preview || (userInList(config['show-button-users']) ?? true);
7777
7878
$effect(() => {
79-
if (preview === previewState) return;
79+
if (preview === previewState || preview === undefined) return;
8080
previewState = preview;
8181
if (previewState) {
8282
setOpenState(true);

0 commit comments

Comments
 (0)