From 47e1575b1348e89c8582d83951a0cd4f5641e63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sat, 18 Oct 2025 20:18:10 +0300 Subject: [PATCH] Mobil cihazlarda Sw update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yanlış update dosyalarının cachelenmesi --- ui/src/views/version/swRegistration.ts | 12 ++++++------ ui/vite.config.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/src/views/version/swRegistration.ts b/ui/src/views/version/swRegistration.ts index 77ac567b..3e6b2ae4 100644 --- a/ui/src/views/version/swRegistration.ts +++ b/ui/src/views/version/swRegistration.ts @@ -1,14 +1,14 @@ import { registerSW } from 'virtual:pwa-register' export const registerServiceWorker = () => { - registerSW({ + const updateSW = registerSW({ immediate: true, onNeedRefresh() { - console.log('🔔 New version available, please refresh.') - window.location.reload() - }, - onOfflineReady() { - console.log('📦 App offline ready') + console.log('[PWA] Yeni sürüm bulundu, otomatik güncellenecek...') + updateSW(true) // ✅ yeni SW’yi aktif et + setTimeout(() => { + window.location.reload() // sayfayı sessizce yenile + }, 1000) }, }) } diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 7854206b..16f71912 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -32,7 +32,7 @@ export default defineConfig(async ({ mode }) => { workbox: { // Büyük asset'leri de cache'leyebil - maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, + maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // EN KRİTİK: yeni SW beklemeden kontrolü alsın clientsClaim: true, @@ -79,7 +79,7 @@ export default defineConfig(async ({ mode }) => { // ⭐ YENİ EKLENEN: Additional navigation route for SPA navigateFallback: '/index.html', - navigateFallbackAllowlist: [/^(?!\/__).*/], + navigateFallbackAllowlist: [/^(?!\/api).*/], }, manifest: {