@leancodepl/force-update 9.6.5 → 9.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,17 +59,17 @@ Vite plugin that creates a `/version` endpoint serving the current app version.
|
|
|
59
59
|
import { listenOnForceUpdate } from "@leancodepl/force-update"
|
|
60
60
|
|
|
61
61
|
useEffect(() => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
const cleanup = listenOnForceUpdate({
|
|
63
|
+
onNewVersionAvailable: () => {
|
|
64
|
+
// Show notification to user or force reload
|
|
65
|
+
if (window.confirm("A new version is available. Reload now?")) {
|
|
66
|
+
window.location.reload()
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
versionCheckIntervalPeriod: 5 * 60 * 1000, // Check every 5 minutes (optional)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return cleanup
|
|
73
73
|
}, [])
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -92,7 +92,7 @@ import { defineConfig } from "vite"
|
|
|
92
92
|
import { vitePluginForceUpdate } from "@leancodepl/force-update"
|
|
93
93
|
|
|
94
94
|
export default defineConfig({
|
|
95
|
-
|
|
95
|
+
plugins: [vitePluginForceUpdate()],
|
|
96
96
|
})
|
|
97
97
|
```
|
|
98
98
|
|