Fix: Karte-Scan wenn Diary-Karte vorher geöffnet — SW by-v406
diary.js lädt Leaflet ohne MarkerCluster. Wenn der User zuerst die
Diary-Karte öffnet, findet _loadLeaflet() in map.js ein gesetztes
window.L und überspringt das Laden komplett — inklusive MarkerCluster.
L.markerClusterGroup() schlägt dann still fehl (catch { return 0; }),
und alle OSM-Layer zeigen 0 Marker.
Fix: Leaflet-Basis und MarkerCluster separat prüfen:
- window.L fehlt → lade Leaflet-Basis
- window.L.markerClusterGroup fehlt → lade MarkerCluster
This commit is contained in:
parent
553e9e7854
commit
8d3a620275
3 changed files with 27 additions and 25 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '385'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '386'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
|
|
||||||
const App = (() => {
|
const App = (() => {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,33 +286,35 @@ window.Page_map = (() => {
|
||||||
// Leaflet + MarkerCluster laden
|
// Leaflet + MarkerCluster laden
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
async function _loadLeaflet() {
|
async function _loadLeaflet() {
|
||||||
if (_leafletLoaded || window.L) { _leafletLoaded = true; return; }
|
if (_leafletLoaded) return;
|
||||||
|
|
||||||
// Leaflet CSS
|
// Leaflet-Basis: nur laden wenn noch nicht vorhanden (diary.js kann es vorgeladen haben)
|
||||||
const lCss = document.createElement('link');
|
if (!window.L) {
|
||||||
lCss.rel = 'stylesheet'; lCss.href = '/css/leaflet.css';
|
const lCss = document.createElement('link');
|
||||||
document.head.appendChild(lCss);
|
lCss.rel = 'stylesheet'; lCss.href = '/css/leaflet.css';
|
||||||
|
document.head.appendChild(lCss);
|
||||||
|
|
||||||
// Leaflet JS
|
await new Promise(resolve => {
|
||||||
await new Promise(resolve => {
|
const s = document.createElement('script');
|
||||||
const s = document.createElement('script');
|
s.src = '/js/leaflet.js'; s.onload = resolve;
|
||||||
s.src = '/js/leaflet.js'; s.onload = resolve;
|
document.head.appendChild(s);
|
||||||
document.head.appendChild(s);
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
// MarkerCluster CSS
|
// MarkerCluster: separat prüfen — diary.js lädt Leaflet ohne MarkerCluster
|
||||||
['MarkerCluster.css', 'MarkerCluster.Default.css'].forEach(f => {
|
if (!window.L.markerClusterGroup) {
|
||||||
const l = document.createElement('link');
|
['MarkerCluster.css', 'MarkerCluster.Default.css'].forEach(f => {
|
||||||
l.rel = 'stylesheet'; l.href = `/css/${f}`;
|
const l = document.createElement('link');
|
||||||
document.head.appendChild(l);
|
l.rel = 'stylesheet'; l.href = `/css/${f}`;
|
||||||
});
|
document.head.appendChild(l);
|
||||||
|
});
|
||||||
|
|
||||||
// MarkerCluster JS
|
await new Promise(resolve => {
|
||||||
await new Promise(resolve => {
|
const s = document.createElement('script');
|
||||||
const s = document.createElement('script');
|
s.src = '/js/leaflet.markercluster.js'; s.onload = resolve;
|
||||||
s.src = '/js/leaflet.markercluster.js'; s.onload = resolve;
|
document.head.appendChild(s);
|
||||||
document.head.appendChild(s);
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
_leafletLoaded = true;
|
_leafletLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v405';
|
const CACHE_VERSION = 'by-v406';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue