diff --git a/app/layout.tsx b/app/layout.tsx index f42e10443..e4df377cf 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -50,7 +50,7 @@ export default function RootLayout({ href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap" rel="stylesheet" > - + {children} diff --git a/public/serviceWorker.js b/public/serviceWorker.js index dff7af9a5..585633fcb 100644 --- a/public/serviceWorker.js +++ b/public/serviceWorker.js @@ -9,7 +9,6 @@ self.addEventListener('install', function (event) { caches.open(CHATGPT_NEXT_WEB_CACHE) .then(function (cache) { return cache.addAll([ - '/', ]); }) ); @@ -22,14 +21,4 @@ self.addEventListener('fetch', function (event) { return response || fetch(event.request); }) ); -}); - -if ('serviceWorker' in navigator) { - window.addEventListener('load', function () { - navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) { - console.log('ServiceWorker registration successful with scope: ', registration.scope); - }, function (err) { - console.error('ServiceWorker registration failed: ', err); - }); - }); -} \ No newline at end of file +}); \ No newline at end of file diff --git a/public/serviceWorkerRegister.js b/public/serviceWorkerRegister.js new file mode 100644 index 000000000..8405f21aa --- /dev/null +++ b/public/serviceWorkerRegister.js @@ -0,0 +1,9 @@ +if ('serviceWorker' in navigator) { + window.addEventListener('load', function () { + navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) { + console.log('ServiceWorker registration successful with scope: ', registration.scope); + }, function (err) { + console.error('ServiceWorker registration failed: ', err); + }); + }); +} \ No newline at end of file