mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 01:58:40 -05:00
ForceReload: update service worker refresh logic (#6162)
This commit is contained in:
committed by
GitHub
parent
1ce2280a49
commit
de04af9ff0
@@ -96,17 +96,19 @@ export function ForceReload() {
|
||||
async function onForceReload() {
|
||||
setReloading(true);
|
||||
try {
|
||||
if (isElectron()) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
if (window.Actual?.applyAppUpdate) {
|
||||
await window.Actual.applyAppUpdate();
|
||||
} else {
|
||||
window.location.reload();
|
||||
if (!isElectron()) {
|
||||
const registration =
|
||||
await window.navigator.serviceWorker.getRegistration('/');
|
||||
if (registration) {
|
||||
await registration.update();
|
||||
if (registration.waiting) {
|
||||
registration.waiting.postMessage({ type: 'SKIP_WAITING' });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// If reload fails, fall back to location.reload()
|
||||
// Do nothing
|
||||
} finally {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
6
upcoming-release-notes/6162.md
Normal file
6
upcoming-release-notes/6162.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
Force reload: update logic for service worker data refresh
|
||||
Reference in New Issue
Block a user