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';