From 0232afd98d3d40f42a0bf3aed64f736bb0308666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deluan=20Quint=C3=A3o?= Date: Wed, 16 Oct 2024 21:39:14 -0400 Subject: [PATCH] fix(ui): service worker does not load new version of ui (#3402) * fix(pwa): wip * fix(pwa): wip --- conf/mime/mime_types.go | 1 + ui/src/index.jsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/conf/mime/mime_types.go b/conf/mime/mime_types.go index 44abd32cc..33542cb8e 100644 --- a/conf/mime/mime_types.go +++ b/conf/mime/mime_types.go @@ -21,6 +21,7 @@ func initMimeTypes() { // In some circumstances, Windows sets JS mime-type to `text/plain`! _ = mime.AddExtensionType(".js", "text/javascript") _ = mime.AddExtensionType(".css", "text/css") + _ = mime.AddExtensionType(".webmanifest", "application/manifest+json") f, err := resources.FS().Open("mime_types.yaml") if err != nil { diff --git a/ui/src/index.jsx b/ui/src/index.jsx index e896e76b5..e2e63d352 100644 --- a/ui/src/index.jsx +++ b/ui/src/index.jsx @@ -3,5 +3,8 @@ window.global = window // fix "global is not defined" error in react-image-light import ReactDOM from 'react-dom' import './index.css' import App from './App' +import { registerSW } from 'virtual:pwa-register' + +registerSW({ immediate: true }) ReactDOM.render(, document.getElementById('root'))