Skip to content

Commit

Permalink
fix: update pwa cache if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Jul 8, 2024
1 parent 461d22f commit 04f9fec
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "pnpm icons && vite build",
"build:only": "vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "pnpm env:gen && vite preview --host",
"env:gen": "vite-node ./scripts/createEnvFile.ts",
Expand Down
7 changes: 1 addition & 6 deletions packages/frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ErrorBoundary } from "react-error-boundary";
import { registerSW } from "virtual:pwa-register";

const ref = {} as any;

if ("serviceWorker" in navigator) {
registerSW({
onRegistered: (r) => (ref.current = r),
onNeedRefresh: () => ref.current?.update(),
});
registerSW({});
}

startReactDsfr({ defaultColorScheme: "system", Link: Link });
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
wasm(),
VitePWA({
devOptions: { enabled: true },
registerType: "autoUpdate",
manifest: {
id: "gouv.beta.compte-rendu-vif",
orientation: "portrait",
Expand Down

0 comments on commit 04f9fec

Please sign in to comment.