nathan-gs / ha-map-card

A Map Card for Home Assistant
https://community.home-assistant.io/t/map-card-a-slightly-improved-map-card/693088
MIT License
19 stars 4 forks source link

Render does not trigger after card is loaded #5

Closed Manuel-Materazzo closed 3 months ago

Manuel-Materazzo commented 4 months ago

Greetings, I'm no expert of lit-element, but it seems that on some instances the render() method does not fire a second time after the page load, leaving the card like this until user interaction (mainly because of the missing map.invalidateSize() call ) : Screenshot 2024-03-15 105158

The issue seems to arise only the first time the dashboard with the map card is loaded, without error output. I've solved the issue with a quick hack, but it would be great if you can look into it.

nathan-gs commented 4 months ago

@Manuel-Materazzo let me know when ready!

nathan-gs commented 4 months ago

ps. I don't have your issue, odd.

Manuel-Materazzo commented 4 months ago

Salutations, I've done some digging on the issue, and it turns out that the card works flawlessly on any pre-2023.7.0 homeassistant versions. I've tested using clean docker container installations, specifically on these versions and using HACS: ... 2023.6.0 - no issues 2023.7.0 - map loading issue 2023.9.0 - map loading issue 2023.10.0 - map loading issue 2023.12.4 - map loading issue 2024.2.2 - map loading issue (my main installation)

Interestingly enough, starting with 2023.7.0 the card_size: 16 property does not create a "full-screen" card by default, unless you select the "panel" view for the dashboard. I guess it might be related, considering that the root of the issue is leaflet not being able to correctly pick up the canvas size.

Also i noticed i messed up the merge request by pushing other things, the "quick hack" i mentioned was on the force first render commit.

nathan-gs commented 3 months ago

@Manuel-Materazzo thanks a lot for testing, I'm on 2023.11 without issue. Will test your PR and provide feedback+merge.

Thanks a lot!

Manuel-Materazzo commented 3 months ago

@Manuel-Materazzo thanks a lot for testing, I'm on 2023.11 without issue. Will test your PR and provide feedback+merge.

Thanks a lot!

Weird, i just tested with a clean docker installation of 2023.11 + hacs and i can reproduce the issue.