mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-03-28 17:42:45 +01:00
perf: Don't block UI on geo cache loading
Geo cache now loads fully in background without blocking setupAutoRefresh(). UI is ready as soon as messages are displayed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -311,18 +311,21 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||
// Update notification toggle UI
|
||||
updateNotificationToggleUI();
|
||||
|
||||
// DEFERRED: Check for updates AFTER messages are displayed
|
||||
// This updates the unread badges without blocking initial load
|
||||
console.log('[init] Checking for updates (deferred)...');
|
||||
checkForUpdates(); // No await - runs in background
|
||||
|
||||
// Wait for geo cache to complete before setting up auto-refresh
|
||||
await geoCachePromise;
|
||||
|
||||
// Setup auto-refresh AFTER initial load is complete
|
||||
// Setup auto-refresh immediately after messages are displayed
|
||||
// Don't wait for geo cache - it's not needed for auto-refresh
|
||||
setupAutoRefresh();
|
||||
|
||||
console.log(`[init] Full initialization complete in ${(performance.now() - initStart).toFixed(0)}ms`);
|
||||
console.log(`[init] UI ready in ${(performance.now() - initStart).toFixed(0)}ms`);
|
||||
|
||||
// DEFERRED: Check for updates AFTER messages are displayed
|
||||
// This updates the unread badges without blocking initial load
|
||||
checkForUpdates(); // No await - runs in background
|
||||
|
||||
// Geo cache loads in background - Map buttons will work once it completes
|
||||
// No need to await - just let it finish whenever
|
||||
geoCachePromise.then(() => {
|
||||
console.log(`[init] Geo cache loaded in ${(performance.now() - initStart).toFixed(0)}ms`);
|
||||
});
|
||||
});
|
||||
|
||||
// Handle page restoration from cache (PWA back/forward navigation)
|
||||
|
||||
Reference in New Issue
Block a user