Skip to content

Commit dd07882

Browse files
committed
fix: too many update dialogues shown
1 parent c0a9aff commit dd07882

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/extensions/default/Phoenix/newly-added-features.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ define(function (require, exports, module) {
6565
Strings.UPDATE_AVAILABLE_TITLE,
6666
Strings.UPDATE_RELOAD_APP
6767
);
68-
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "updateDlg", "shown");
68+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "updateDlg",
69+
window.Phoenix.updatePendingReloadReason || "shown");
6970
}
7071
}, 5000);
7172
}

src/phoenix/virtual-server-loader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
100100
if(lastClearedVersion !== newCacheVersion) {
101101
console.log(`Service worker loader: triggering CLEAR_CACHE for live preview service worker upgrade`);
102102
window.Phoenix.updatePendingReload = true;
103+
window.Phoenix.updatePendingReloadReason = "clearCache";
103104
wb.messageSW({
104105
type: 'CLEAR_CACHE'
105106
});
@@ -120,6 +121,7 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
120121
console.log(`Service worker loader: updatedFilesCount: `, updatedFilesCount);
121122
if(updatedFilesCount >0) {
122123
window.Phoenix.updatePendingReload = true;
124+
window.Phoenix.updatePendingReloadReason = "refreshCache";
123125
}
124126
}).catch(err=>{
125127
console.error("Service worker loader: Error while triggering cache refresh", err);
@@ -174,7 +176,7 @@ if (_isServiceWorkerLoaderPage() && 'serviceWorker' in navigator) {
174176
// service worker has installed but is waiting to activate.
175177
wb.addEventListener('waiting', (event) => {
176178
console.log("Service worker loader: A new service worker is pending load. Trying to update the worker now.");
177-
window.Phoenix.updatePendingReload = true;
179+
// window.Phoenix.updatePendingReload = true; not set here to not show too many update dialogues.
178180
showSkipWaitingPrompt(event);
179181
});
180182

0 commit comments

Comments
 (0)