[fix](trx-frontend-http): buffer decode messages until map-data plugins are ready

Eagerly load map-data plugins (AIS, APRS, VDES, HF-APRS) on startup and
buffer any decode history or live SSE messages that arrive before plugin
handlers register. Each plugin drains its pending buffer on init.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-04-04 12:08:18 +02:00
parent f978812090
commit 79068e55af
6 changed files with 65 additions and 14 deletions
@@ -1620,6 +1620,7 @@
(function() {
var pluginScripts = {
'digital-modes': ['/ft8.js', '/ft4.js', '/ft2.js', '/wspr.js', '/cw.js', '/background-decode.js', '/sat.js', '/wefax.js'],
'map-data': ['/map-core.js', '/ais.js', '/vdes.js', '/aprs.js', '/hf-aprs.js'],
'map': ['/map-core.js', '/leaflet-ais-tracksymbol.js', '/ais.js', '/vdes.js', '/aprs.js', '/hf-aprs.js', '/sat.js', '/sat-scheduler.js'],
'statistics': ['/map-core.js'],
'bookmarks': ['/bookmarks.js'],
@@ -1639,8 +1640,12 @@
document.body.appendChild(s);
});
}
// Load core plugins immediately (needed on main tab)
['digital-modes', 'bookmarks', 'settings'].forEach(loadPlugins);
// Load core plugins immediately (needed on main tab).
// 'map-data' loads map-core.js + data handlers (ais/aprs/vdes/hf-aprs) eagerly
// so decode history replay can populate map data structures before the map
// tab is opened. The 'loaded' Set prevents double-loading when the map tab
// is later activated.
['digital-modes', 'map-data', 'bookmarks', 'settings'].forEach(loadPlugins);
// Load others on tab switch
document.addEventListener('click', function(e) {
var tab = e.target.closest('[data-tab]');