[8.10] [maps] fix 'by value' map does not fill dashboard panel on initial page load in 8.10 (#165326) (#165369)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[maps] fix 'by value' map does not fill dashboard panel on initial
page load in 8.10
(#165326)](https://github.com/elastic/kibana/pull/165326)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2023-08-31T16:33:56Z","message":"[maps]
fix 'by value' map does not fill dashboard panel on initial page load in
8.10 (#165326)\n\nFixes
https://github.com/elastic/kibana/issues/165183\r\n\r\n### Test
instructions\r\n1) install any sample data set\r\n2) open new
dashboard\r\n3) Use \"Add panel\" buttons to add by-value map with only
base map layer\r\n4) Ensure map tiles fill entire map panel in
dashboard\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"168412ba7b61bde4ed810ef34e2e951d4e68d0fc","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","v8.10.0","v8.11.0"],"number":165326,"url":"https://github.com/elastic/kibana/pull/165326","mergeCommit":{"message":"[maps]
fix 'by value' map does not fill dashboard panel on initial page load in
8.10 (#165326)\n\nFixes
https://github.com/elastic/kibana/issues/165183\r\n\r\n### Test
instructions\r\n1) install any sample data set\r\n2) open new
dashboard\r\n3) Use \"Add panel\" buttons to add by-value map with only
base map layer\r\n4) Ensure map tiles fill entire map panel in
dashboard\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"168412ba7b61bde4ed810ef34e2e951d4e68d0fc"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165326","number":165326,"mergeCommit":{"message":"[maps]
fix 'by value' map does not fill dashboard panel on initial page load in
8.10 (#165326)\n\nFixes
https://github.com/elastic/kibana/issues/165183\r\n\r\n### Test
instructions\r\n1) install any sample data set\r\n2) open new
dashboard\r\n3) Use \"Add panel\" buttons to add by-value map with only
base map layer\r\n4) Ensure map tiles fill entire map panel in
dashboard\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"168412ba7b61bde4ed810ef34e2e951d4e68d0fc"}}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-31 20:00:31 -04:00 committed by GitHub
parent 5c50d2b681
commit a2924642b5
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';