mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 22:59:59 -07:00
fix: first-load rendering for Waterfall CSS and WebSDR globe
- Waterfall: load waterfall.css eagerly in <head> instead of lazily on mode switch; the lazy inject raced with the panel becoming visible, leaving unstyled HTML for up to 20 s on cold cache - WebSDR: await a requestAnimationFrame before calling Globe()(mapEl) so the browser has committed the display:flex layout and clientWidth/ clientHeight are non-zero; previously the globe WebGL renderer was created at 0×0 (especially on warm-cache refreshes) and could not recover via the deferred resize calls - Bump version to 2.22.2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,17 @@ async function initWebSDR() {
|
||||
if (!mapEl) return;
|
||||
|
||||
const globeReady = await ensureWebsdrGlobeLibrary();
|
||||
|
||||
// Wait for a paint frame so the browser computes layout after the
|
||||
// display:flex change in switchMode. Without this, Globe()(mapEl) can
|
||||
// run before clientWidth/clientHeight are non-zero (especially when
|
||||
// scripts are served from cache and resolve before the first layout pass).
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
|
||||
// If the mode was switched away while scripts were loading, abort so
|
||||
// websdrInitialized stays false and we retry cleanly next time.
|
||||
if (!mapEl.clientWidth || !mapEl.clientHeight) return;
|
||||
|
||||
if (globeReady && initWebsdrGlobe(mapEl)) {
|
||||
websdrMapType = 'globe';
|
||||
} else if (typeof L !== 'undefined' && await initWebsdrLeaflet(mapEl)) {
|
||||
|
||||
Reference in New Issue
Block a user