From 459b60c9aa1d076c9af4d4f0be003df3c78e6381 Mon Sep 17 00:00:00 2001 From: Egor Pozharov Date: Tue, 21 Apr 2026 16:26:01 +0600 Subject: [PATCH] remove manual update prompt UI and enable automatic silent service worker updates --- frontend/src/components/ui/UpdatePrompt.tsx | 28 ++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/ui/UpdatePrompt.tsx b/frontend/src/components/ui/UpdatePrompt.tsx index fac22c4..08211e8 100644 --- a/frontend/src/components/ui/UpdatePrompt.tsx +++ b/frontend/src/components/ui/UpdatePrompt.tsx @@ -1,6 +1,5 @@ +import { useEffect } from 'react'; import { useRegisterSW } from 'virtual:pwa-register/react'; -import { RefreshCw } from 'lucide-react'; -import { Button } from './Button'; // Check for SW updates every hour and on tab focus/visibility change const UPDATE_INTERVAL_MS = 60 * 60 * 1000; @@ -33,23 +32,12 @@ export function UpdatePrompt() { }, }); - if (!needRefresh) return null; + useEffect(() => { + if (needRefresh) { + console.log('[PWA] New version detected, auto-updating...'); + updateServiceWorker(true); + } + }, [needRefresh, updateServiceWorker]); - return ( -
-
-
- - Доступна новая версия приложения -
- -
-
- ); + return null; }