Skip to content

Commit

Permalink
fix: sw, my-sw 사용시 serviceWorker.js로 대치
Browse files Browse the repository at this point in the history
  • Loading branch information
wildcatco committed Aug 24, 2023
1 parent 937bcb7 commit 42c3555
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions public/my-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ if ('serviceWorker' in navigator) {
});
});
}

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
6 changes: 6 additions & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ if ('serviceWorker' in navigator) {
});
});
}

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
6 changes: 3 additions & 3 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default function HomePage() {

return (
<PageWrapper>
{/*<Suspense fallback={null}>*/}
{/* <HomeHeader onClickLogo={scrollToTop} />*/}
{/*</Suspense>*/}
<Suspense fallback={null}>
<HomeHeader onClickLogo={scrollToTop} />
</Suspense>
<main
ref={(el) =>
assignMultipleRefs(el, [
Expand Down
1 change: 0 additions & 1 deletion src/serviceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ precacheAndRoute(self.__WB_MANIFEST);

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
console.log('here');
self.skipWaiting();
clientsClaim();
}
Expand Down

0 comments on commit 42c3555

Please sign in to comment.