mirror of
https://github.com/home-assistant/frontend.git
synced 2026-08-13 08:32:32 +01:00
Leaflet computes the zoom level that fits a set of bounds from the current size of the map container. When ha-map's fit runs before the browser has laid out the container (a race that hits when the Leaflet chunks are already cached), the container measures 0x0, the computed zoom collapses to the minimum, and the map shows the entire world. The later invalidateSize() from the resize observer fixes the size but keeps the zoom, so the map stays on the world view. Defer fitting while the container has no size and run the pending fit once the resize observer reports a usable size. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>