refreshable-picture-card icon indicating copy to clipboard operation
refreshable-picture-card copied to clipboard

Detect expired URL in IMG tag and reload, avoid IMG tag with an empty src

Open k3a opened this issue 1 year ago • 0 comments

When a dashboard with this component is opened in Home Assistant companion app (android) and put in the background (by pressing Home button or multi-tasking) and then opened again after couple of minutes, sometimes it would display a broken image symbol because the URL in the src attribute has expired in the meantime (token has expired).

This patch attempts to reload the image with a fresh token immediately. It does that only once to avoid a crazy loop of reloads for a broken link (for a permanently broken URL). A successful image load resets the error state and allows one additional reload again.

k3a avatar Sep 23 '23 20:09 k3a