Skip to content

Commit 8a4d70c

Browse files
committed
moved cleanupOutdatedCaches to controllerchange
1 parent e3b5a9a commit 8a4d70c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
import { URLS } from './config'
2727
import Hotjar from './components/Hotjar/Hotjar'
2828
import { validateToken } from './services/service'
29+
import { cleanupOutdatedCaches } from 'workbox-precaching'
2930

3031
const NavigationRoutes = lazy(() => import('./components/common/navigation/NavigationRoutes'))
3132
const Login = lazy(() => import('./components/login/Login'))
@@ -135,6 +136,7 @@ export default function App() {
135136
if (refreshing.current) {
136137
return
137138
}
139+
cleanupOutdatedCaches()
138140
if (document.visibilityState === 'visible') {
139141
window.location.reload()
140142
refreshing.current = true

src/service-worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// import { NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies'
55
// import { clientsClaim } from 'workbox-core'
66

7-
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
7+
import { createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
88
import { NavigationRoute, registerRoute } from 'workbox-routing'
99
import { clientsClaim } from 'workbox-core'
1010

@@ -21,7 +21,7 @@ self.addEventListener('message', (event) => {
2121
precacheAndRoute(self.__WB_MANIFEST)
2222

2323
// clean old assets
24-
cleanupOutdatedCaches()
24+
// cleanupOutdatedCaches()
2525

2626
// to allow work offline
2727
registerRoute(new NavigationRoute(createHandlerBoundToURL('index.html')))

0 commit comments

Comments
 (0)