Skip to content

Fix card flashing icon-only on load - #339

Merged
MrBartusek merged 7 commits into
masterfrom
fix/blinking-on-load
Aug 22, 2026
Merged

Fix card flashing icon-only on load#339
MrBartusek merged 7 commits into
masterfrom
fix/blinking-on-load

Conversation

@MrBartusek

@MrBartusek MrBartusek commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Fixes #338

On first update the card's content sits inside ha-card before it has rendered its slot, so the slides have no layout box and measure 0 wide. measureCard() read that as "nothing fits" and collapsed the card to icon only, until a debounced resize observer corrected it a quarter of a second later.

Slides that are not laid out yet are now skipped, and the card re-measures on every update. Dropping the 250ms debounce also stops the headline swapping a moment after Home Assistant reflows the masonry columns.

Before

blink-after.mp4

After

blink-before.mp4

The card renders inside ha-card, which is not defined yet on first update.
An undefined ha-card has no shadow root and so no slot, leaving its children
unslotted with a zero layout box, so measureCard() fell back to icon only.
Skip slides that are not laid out yet, and re-measure on every update.

Also replace the 250ms debounce on the resize observer with a synchronous
measure, so the headline no longer visibly swaps after Home Assistant
reflows the masonry columns.
@MrBartusek
MrBartusek merged commit bc9c0b7 into master Aug 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card flashes icon-only before showing its headline

1 participant