fix: refresh sw when browser refreshed (#6824)
* fix: refresh sw when browser refreshed * dummy test * enable immediate reload * test * fix * autoupdate * don't immediate * test * testing testing * test * test * its same * revert logs * fix types ---------
This commit is contained in:
parent
5dd1efde8a
commit
66bac50de3
@ -1,11 +1,14 @@
|
|||||||
import { StrictMode } from "react";
|
import { StrictMode } from "react";
|
||||||
import { createRoot } from "react-dom/client";
|
import { createRoot } from "react-dom/client";
|
||||||
import ExcalidrawApp from "./excalidraw-app";
|
import ExcalidrawApp from "./excalidraw-app";
|
||||||
|
import { registerSW } from "virtual:pwa-register";
|
||||||
|
|
||||||
import "./excalidraw-app/sentry";
|
import "./excalidraw-app/sentry";
|
||||||
window.__EXCALIDRAW_SHA__ = import.meta.env.VITE_APP_GIT_SHA;
|
window.__EXCALIDRAW_SHA__ = import.meta.env.VITE_APP_GIT_SHA;
|
||||||
const rootElement = document.getElementById("root")!;
|
const rootElement = document.getElementById("root")!;
|
||||||
const root = createRoot(rootElement);
|
const root = createRoot(rootElement);
|
||||||
|
registerSW();
|
||||||
|
|
||||||
root.render(
|
root.render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<ExcalidrawApp />
|
<ExcalidrawApp />
|
||||||
|
3
src/vite-env.d.ts
vendored
3
src/vite-env.d.ts
vendored
@ -1,8 +1,7 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
/// <reference types="vite-plugin-pwa/react" />
|
/// <reference types="vite-plugin-pwa/vanillajs" />
|
||||||
/// <reference types="vite-plugin-pwa/info" />
|
/// <reference types="vite-plugin-pwa/info" />
|
||||||
/// <reference types="vite-plugin-svgr/client" />
|
/// <reference types="vite-plugin-svgr/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
// The port to run the dev server
|
// The port to run the dev server
|
||||||
VITE_APP_PORT: string;
|
VITE_APP_PORT: string;
|
||||||
|
@ -53,6 +53,7 @@ export default defineConfig({
|
|||||||
svgrPlugin(),
|
svgrPlugin(),
|
||||||
ViteEjsPlugin(),
|
ViteEjsPlugin(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
|
registerType: "autoUpdate",
|
||||||
devOptions: {
|
devOptions: {
|
||||||
/* set this flag to true to enable in Development mode */
|
/* set this flag to true to enable in Development mode */
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user