Skip to content

Commit 5249c85

Browse files
author
Paul C
committed
v22.6.13: guard initMap/updateMap against Leaflet load race (L is not defined)
1 parent b744707 commit 5249c85

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wolfstack"
3-
version = "22.6.12"
3+
version = "22.6.13"
44
edition = "2024"
55
authors = ["Wolf Software Systems Ltd"]
66
description = "Server management platform for the Wolf software suite"

web/js/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,11 @@ function initMap() {
24172417
if (worldMap) return;
24182418
const mapEl = document.getElementById('world-map');
24192419
if (!mapEl) return;
2420+
// Leaflet is loaded with `defer` in index.html but app.js is injected via
2421+
// document.write without defer, so on cold loads `L` may not be ready when
2422+
// the first dashboard render fires updateMap(). Bail quietly — the next
2423+
// poll tick will retry once Leaflet has parsed.
2424+
if (typeof L === 'undefined') return;
24202425

24212426
worldMap = L.map('world-map', {
24222427
attributionControl: false,
@@ -2430,6 +2435,7 @@ function initMap() {
24302435

24312436
function updateMap(nodes) {
24322437
if (!document.getElementById('world-map')) return;
2438+
if (typeof L === 'undefined') return;
24332439
if (!worldMap) initMap();
24342440
if (!worldMap) return;
24352441

0 commit comments

Comments
 (0)