feat: modularize scanner, enhance carousel preloading, and improve PWA updates
Summary of changes: - Extracted archive scanning logic into a modular 'useArchiveScanner' hook for better maintainability and performance. - Refined PostModal carousel with intelligent media preloading and smoother, jitter-free transitions. - Optimized image rendering with 'decoding=async' and removed 'black flashes' between slide changes. - Updated PWA configuration to 'autoUpdate' with hourly periodic checks for fresh content. - Fixed several bugs including stories sorting, permalink parameter cleanup, and profile metadata cache restoration. - Comprehensive updates to documentation (README.md and GEMINI.md) reflecting the new architecture.
This commit is contained in:
+19
-1
@@ -4,7 +4,25 @@ import App from './App.tsx';
|
||||
import './index.css';
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
|
||||
registerSW();
|
||||
// Register service worker with automatic updates
|
||||
// and a periodic check every hour to ensure long-running sessions stay fresh.
|
||||
const updateSW = registerSW({
|
||||
onRegistered(r) {
|
||||
if (r) {
|
||||
// Check for updates every hour
|
||||
setInterval(() => {
|
||||
r.update();
|
||||
}, 60 * 60 * 1000);
|
||||
console.log('[PWA] Service Worker registered and update interval set.');
|
||||
}
|
||||
},
|
||||
onNeedRefresh() {
|
||||
console.log('[PWA] New content available, reloading...');
|
||||
},
|
||||
onOfflineReady() {
|
||||
console.log('[PWA] App is ready for offline use.');
|
||||
}
|
||||
});
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
|
||||
Reference in New Issue
Block a user