diff --git a/packages/desktop-client/bin/build-browser b/packages/desktop-client/bin/build-browser index f53151b442..3e6e18aa6c 100755 --- a/packages/desktop-client/bin/build-browser +++ b/packages/desktop-client/bin/build-browser @@ -9,7 +9,6 @@ rm -fr build export IS_GENERIC_BROWSER=1 export REACT_APP_BACKEND_WORKER_HASH=`ls "$ROOT"/../public/kcab/kcab.worker.*.js | sed 's/.*kcab\.worker\.\(.*\)\.js/\1/'` -export REACT_APP_PLUGIN_SERVICE_WORKER_HASH=`ls "$ROOT"/../service-worker/plugin-sw.*.js | sed 's/.*plugin-sw\.\(.*\)\.js/\1/'` yarn build diff --git a/packages/desktop-client/bin/watch-browser b/packages/desktop-client/bin/watch-browser index d90eba99c1..2f2861696f 100755 --- a/packages/desktop-client/bin/watch-browser +++ b/packages/desktop-client/bin/watch-browser @@ -6,6 +6,5 @@ cd "$ROOT/.." export IS_GENERIC_BROWSER=1 export PORT=3001 export REACT_APP_BACKEND_WORKER_HASH="dev" -export REACT_APP_PLUGIN_SERVICE_WORKER_HASH="dev" yarn start diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mts index ca117fb285..d51a281eef 100644 --- a/packages/desktop-client/vite.config.mts +++ b/packages/desktop-client/vite.config.mts @@ -26,15 +26,6 @@ const addWatchers = (): Plugin => ({ }, }); -// Get service worker filename from environment variable -function getServiceWorkerFilename(): string { - const hash = process.env.REACT_APP_PLUGIN_SERVICE_WORKER_HASH; - if (hash) { - return `plugin-sw.${hash}.js`; - } - return 'plugin-sw.js'; // fallback -} - // Inject build shims using the inject plugin const injectShims = (): Plugin[] => { const buildShims = path.resolve('./src/build-shims.js'); @@ -170,7 +161,7 @@ export default defineConfig(async ({ mode }) => { registerType: 'prompt', strategies: 'injectManifest', srcDir: 'service-worker', - filename: getServiceWorkerFilename(), + filename: 'plugin-sw.js', manifest: { name: 'Actual', short_name: 'Actual', @@ -182,7 +173,7 @@ export default defineConfig(async ({ mode }) => { }, injectManifest: { maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10MB - swSrc: `service-worker/${getServiceWorkerFilename()}`, + swSrc: `service-worker/plugin-sw.js`, }, devOptions: { enabled: true, // We need service worker in dev mode to work with plugins diff --git a/packages/plugins-service/src/plugin-service-worker.ts b/packages/plugins-service/src/plugin-service-worker.ts index 02d116ddff..f63f43220f 100644 --- a/packages/plugins-service/src/plugin-service-worker.ts +++ b/packages/plugins-service/src/plugin-service-worker.ts @@ -28,7 +28,6 @@ const fileList = new Map(); // Log installation event self.addEventListener('install', (_event: ExtendableEvent) => { console.log('Plugins Worker installing...'); - self.skipWaiting(); // Forces activation immediately }); // Log activation event @@ -64,6 +63,8 @@ self.addEventListener('fetch', (event: FetchEvent) => { ? pathSegments[slugIndex + 1].split('?')[0] : ''; event.respondWith(handlePlugin(slug, fileName.replace('?import', ''))); + } else { + event.respondWith(fetch(event.request)); } }); diff --git a/packages/plugins-service/vite.config.mts b/packages/plugins-service/vite.config.mts index 1eedc93a04..a4026a29a1 100644 --- a/packages/plugins-service/vite.config.mts +++ b/packages/plugins-service/vite.config.mts @@ -6,7 +6,6 @@ import { defineConfig } from 'vite'; export default defineConfig(({ mode }) => { const isDev = mode === 'development'; const outDir = path.resolve(__dirname, 'dist'); - const buildHash = Date.now().toString(36); return { mode, @@ -18,8 +17,7 @@ export default defineConfig(({ mode }) => { entry: path.resolve(__dirname, 'src/plugin-service-worker.ts'), name: 'plugin_sw', formats: ['iife'], - fileName: () => - isDev ? `plugin-sw.dev.js` : `plugin-sw.${buildHash}.js`, + fileName: () => `plugin-sw.js`, }, sourcemap: true, minify: isDev ? false : 'terser', diff --git a/upcoming-release-notes/5963.md b/upcoming-release-notes/5963.md new file mode 100644 index 0000000000..d55793e0ba --- /dev/null +++ b/upcoming-release-notes/5963.md @@ -0,0 +1,7 @@ +--- +category: Bugfix +authors: [lelemm] +--- + +Fix notification display for updating the service worker in the application. +