[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>
This commit is contained in:
Nathan Reese 2023-08-31 10:33:56 -06:00 committed by GitHub
parent 186a202b05
commit 168412ba7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,8 +191,13 @@ export class MbMap extends Component<Props, State> {
}
});
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';