Skip to content

Commit

Permalink
fix: sw -> my-sw
Browse files Browse the repository at this point in the history
  • Loading branch information
wildcatco committed Aug 24, 2023
1 parent 5fe9bff commit 206f5fc
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 15 deletions.
7 changes: 0 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,4 @@
<div id="root" class="h-full"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js', { scope: '/' });
});
}
</script>
</html>
1 change: 0 additions & 1 deletion src/common/components/ui/inputs/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export function TextInput({
};

const handleReset = () => {
console.log('here');
setValue('');
inputRef.current?.focus();
onChange && onChange('');
Expand Down
2 changes: 0 additions & 2 deletions src/common/hooks/useUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ export function useUpdate() {
const { updateServiceWorker } = useRegisterSW({
onRegistered: (r) => {
if (!r) return;

r.update();
setInterval(() => {
console.log('interval');
r.update();
}, UPDATE_INTERVAL);
},
Expand Down
6 changes: 1 addition & 5 deletions src/my-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ cleanupOutdatedCaches();

precacheAndRoute(self.__WB_MANIFEST);

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
self.skipWaiting();
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default defineConfig({
svgr(),
VitePWA({
registerType: 'prompt',
injectRegister: 'script',
strategies: 'injectManifest',
injectManifest: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2,otf}'],
Expand Down

0 comments on commit 206f5fc

Please sign in to comment.