Quick update: On occasion, the map does still disappear. I’ve updated ionViewWillEnter
as follows…
ionViewWillEnter(){
if (!this.initialMapLoad) {
this.map.setDiv('map');
this.map.setVisible(true);
setTimeout(()=>{
// hack to fix occasionally disappearing map
this.map.setDiv('map');
}, 1000);
} else {
this.initialMapLoad = false;
}
}
This consistently fixes the issue after 1000ms when the map hasn’t loaded automatically (maybe 1 in 10-20 times), and doesn’t seem to interfere in any way when it’s unnecessary (most of the time).
Ideally there would be some condition I could check to detect when the hack is actually necessary but I can’t seem to find any way to test if the map is properly loaded and displayed (e.g. getDiv()
returns an object even when the map has failed to load).