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-widget): ensure map renders correctly when expanding initially collapsed sections (#6541) #7229

Merged
merged 5 commits into from
Jun 26, 2024

Conversation

afieif
Copy link
Contributor

@afieif afieif commented Jun 12, 2024

Fixes #6541

Summary

This pull request addresses the issue where the Map Widget does not display correctly when part of an initially collapsed object, only rendering upon window resize or opening dev tools. The problem was caused by the map not updating its size when the container element became visible.

The fix involves adding a ResizeObserver to the map container to trigger the map size update whenever the container is resized, ensuring the map renders correctly when the section is expanded.

Test plan

  1. Create a map widget inside a collapsible section.
  2. Initially, keep the section collapsed.
  3. Expand the section and observe the map rendering correctly without the need for a window resize or opening dev tools.

Add the following field to the config for testing

- label: "Location"
        name: "location"
        widget: "object"
        collapsed: true
        fields:
          - { label: "LatLong", name: "latlong", widget: "map" }

Video Demonstration

OLD.mp4
NEW.mp4

Checklist

@afieif afieif requested a review from a team as a code owner June 12, 2024 10:50
martinjagodic
martinjagodic previously approved these changes Jun 17, 2024
Copy link
Member

@martinjagodic martinjagodic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks!

@martinjagodic martinjagodic enabled auto-merge (squash) June 26, 2024 13:14
@martinjagodic martinjagodic merged commit 041e34e into decaporg:main Jun 26, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map widget if part of an object that is initially collapsed does not show when expanded
2 participants