From 5f5118eb4e2f8c808f279bada4dae6b44c641688 Mon Sep 17 00:00:00 2001 From: nreese Date: Thu, 31 Aug 2023 06:46:33 -0600 Subject: [PATCH] [maps] fix 'by value' map does not fill dashboard panel on initial page load in 8.11 --- .../maps/public/connected_components/mb_map/mb_map.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx index 5c71696cb280b..51b61f2dbc649 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx +++ b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx @@ -191,8 +191,13 @@ export class MbMap extends Component { } }); mbMap.on('load', () => { - emptyImage = new Image(); + // Map instance automatically resizes when container size changes. + // However, issues may arise if container resizes before map finishes loading. + // This is occuring when by-value maps are used in dashboard. + // To prevent issues, resize container after load + mbMap.resize(); + emptyImage = new Image(); emptyImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII='; emptyImage.crossOrigin = 'anonymous';