embeds: fix reloading: reload only the embed frame, add counter to only reload twice
This commit is contained in:
+6
-2
@@ -25,6 +25,7 @@ class Embed extends LitElement
|
||||
this.deepLink = false;
|
||||
this.swInited = false;
|
||||
this.embed = null;
|
||||
this.reloadCount = 0;
|
||||
}
|
||||
|
||||
static get properties() {
|
||||
@@ -188,11 +189,14 @@ Please try a different browser.\n
|
||||
const win = event.target.contentWindow;
|
||||
const doc = event.target.contentDocument;
|
||||
|
||||
if (win.navigator.serviceWorker && !win.navigator.serviceWorker.controller) {
|
||||
setTimeout(() => window.location.reload(), 100);
|
||||
if (win.navigator.serviceWorker && !win.navigator.serviceWorker.controller && this.reloadCount <= 2) {
|
||||
this.reloadCount++;
|
||||
setTimeout(() => win.location.reload(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
this.reloadCount = 0;
|
||||
|
||||
if (win.customElements.get("replay-app-main")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user