Skip to content

Commit 8f9d66d

Browse files
committed
service worker issue fix
1 parent 83579a2 commit 8f9d66d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,14 @@ export default function App() {
164164
}
165165

166166
useEffect(() => {
167+
if (window.isSecureContext && navigator.serviceWorker) {
167168
// check for sw updates on page change
168169
navigator.serviceWorker.getRegistrations().then((regs) => regs.forEach((reg) => reg.update()))
169170
if (!needRefresh) {
170171
return
171172
}
172173
update()
174+
}
173175
}, [location])
174176

175177
function onUpdate() {

0 commit comments

Comments
 (0)