-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid re-rendering map with "sources" #18635
Conversation
Maybe I'm misunderstanding but this change doesn't look right to me. You've replaced updating on hasConfigOrEntitiesChanged with just updating when an entity state string changes (e.g. "home" -> "away"). But this seems like it will reject update when an entity moves around without changing zone, The map should redraw anytime one of the watched entities moves, right? The was another issue I tried to work on once that would have had the map stop autofitting once a user manually interacted with the map, like manually trying to move it. I couldn't quite figure out how to make that work right so I gave up on it. Maybe that would be a better solution for you if it could be made to work? When you were debugging did you see what was triggering it to rerender constantly, were the geo sources moving or something? |
You're right. The comparison should be identical to the one that is here and include all of the state object, including the "latitude" and "longitude" attributes. The code was changed accordingly. Thanks!
The use case I'm trying to address is geo_location entities which are coming and going (they have a lifetime of 10 minutes). These entities have constant coordinates. We do want to auto-fit the map when there is a new entity, but allow the user to interact with the map (e.g. zoom out on in) while the data on the map hasn't changed.
The debugging was focused on the use case described above ("source" entities with constant coordinates.) However, this change should be correct for any scenario. There is no need to re-render the element when there is no change in the data (causing the element to auto-fit for no reason, when this option is used.) |
The issue probably is |
Below are additional details on the change and its approach.
To summarize: the change is to make (There was no attempt to make a different use or a change in the |
I believe this change broke auto-fit for regular entities, the map no longer follows them. Previously Should willUpdate not be conditioned on having geo_location_sources?
|
Fixing with #18799 |
Breaking change
Proposed change
Map card can be configured with
geo_location_sources
. It was impossible to interact with the map whenauto_fit
was also used. The map would reset its view every second (or so).The fix is to keep the object of the map's entity list, unless there is a real change.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: