From ac38ae2a54f041dd627a26e1aeb6e6b2902404a9 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 26 Jun 2026 18:34:17 +0200 Subject: [PATCH] fix(home): wrap map init in DOMContentLoaded to fix broken homepage map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the CDN elimination refactor, maplibregl moved from an inline head script to the bottom-group bundle — but home.html.twig still called new maplibregl.Map() immediately, before map.js had loaded. Wraps both the active-trip and between-trips script blocks in DOMContentLoaded, matching the pattern already used in trip/map/feed-map templates. Co-Authored-By: Claude Sonnet 4.6 --- themes/intotheeast/templates/home.html.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/themes/intotheeast/templates/home.html.twig b/themes/intotheeast/templates/home.html.twig index 88eb04a..7498ece 100644 --- a/themes/intotheeast/templates/home.html.twig +++ b/themes/intotheeast/templates/home.html.twig @@ -90,6 +90,7 @@ var HOME_GPX_URLS = {{ home_gpx_urls|json_encode|raw }}; var USE_GPX = {{ trip and trip.header.use_gpx is not null ? (trip.header.use_gpx ? 'true' : 'false') : 'true' }}; var AUTOCONNECT = "{{ trip ? (trip.header.autoconnect ?? 'on') : 'on' }}"; +document.addEventListener('DOMContentLoaded', function() { var homeMap = new maplibregl.Map({ container: 'home-map', style: MapUtils.MAP_STYLE, @@ -133,6 +134,7 @@ homeMap.on('load', function () { MapUtils.renderGpxJourney(homeMap, USE_GPX ? HOME_GPX_URLS : [], HOME_ENTRIES, 'home-gpx', 'home-journey', { connectMode: AUTOCONNECT }); }); +}); // DOMContentLoaded {% endif %} @@ -244,6 +246,7 @@ homeMap.on('load', function () { {% endif %}