Skip to content

Commit 2ab0076

Browse files
committed
refactor(app): replaced sw behavior from prompt to auto update and claims
1 parent 83907ec commit 2ab0076

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

apps/codeimage/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {Footer} from './components/Footer/Footer';
1111
import {Frame} from './components/Frame/Frame';
1212
import {FrameHandler} from './components/Frame/FrameHandler';
1313
import {KeyboardShortcuts} from './components/KeyboardShortcuts/KeyboardShortcuts';
14-
import ReloadPrompt from './components/PromptUpdate/PromptUpdate';
1514
import {EditorSidebar} from './components/PropertyEditor/EditorSidebar';
1615
import {Canvas} from './components/Scaffold/Canvas/Canvas';
1716
import {Scaffold} from './components/Scaffold/Scaffold';
@@ -42,7 +41,6 @@ const App = () => {
4241
return (
4342
<Scaffold>
4443
<SnackbarHost />
45-
<ReloadPrompt />
4644

4745
<Show when={modality === 'full'}>
4846
<Sidebar position={'left'}>

apps/codeimage/src/sw.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
import {clientsClaim} from 'workbox-core';
12
import {cleanupOutdatedCaches, precacheAndRoute} from 'workbox-precaching';
23
import {registerRoute} from 'workbox-routing';
34
import {StaleWhileRevalidate} from 'workbox-strategies';
45

56
declare let self: ServiceWorkerGlobalScope;
67

7-
self.addEventListener('message', event => {
8-
if (event.data && event.data.type === 'SKIP_WAITING') self.skipWaiting();
9-
});
10-
118
// self.__WB_MANIFEST is default injection point
129
precacheAndRoute(self.__WB_MANIFEST);
1310
// Cache the Google Fonts stylesheets with a stale-while-revalidate strategy.
@@ -24,3 +21,6 @@ registerRoute(
2421
new RegExp('/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2)'),
2522
new StaleWhileRevalidate(),
2623
);
24+
25+
self.skipWaiting();
26+
clientsClaim();

0 commit comments

Comments
 (0)