From 293e7a4e277ec462ddd089161ae0fb38333edf69 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 31 Aug 2023 10:33:56 -0600 Subject: [PATCH] [maps] fix 'by value' map does not fill dashboard panel on initial page load in 8.10 (#165326) Fixes https://github.com/elastic/kibana/issues/165183 ### Test instructions 1) install any sample data set 2) open new dashboard 3) Use "Add panel" buttons to add by-value map with only base map layer 4) Ensure map tiles fill entire map panel in dashboard Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 168412ba7b61bde4ed810ef34e2e951d4e68d0fc) --- .../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';