Skip to content
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

Fix map card not loading in sidebar view #14872

Merged
merged 2 commits into from
Dec 27, 2022

Conversation

karwosts
Copy link
Contributor

Proposed change

Current map card seems to expect setConfig to be called before firstUpdated, and then during firstUpdated, it uses the aspect ratio from _config to pad out the size of the map card needed to fit the desired aspect ratio.

However in sidebar view, the majority of time these steps seem to happen out of order. firstUpdate seems to be called before setConfig. So in firstUpdate when the aspect ratio is processed, there is no config and no aspect ratio, so the necessary paddingBottom is not applied, and the card is rendered at 0 pixels height.

Instead of assuming that _config is ready during first update, this change fixes map card to watch for changes to _config, and update the padding when change to _config is detected.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten bramkragten merged commit 1c139d0 into home-assistant:dev Dec 27, 2022
@karwosts karwosts deleted the map_aspect_fix12023_2 branch December 27, 2022 21:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map card does not show up in main view of the sidebar view type
2 participants