embeds: fix reloading: reload only the embed frame, add counter to only reload twice

This commit is contained in:
Ilya Kreymer
2020-08-26 12:59:20 -07:00
parent 4d4889b1b6
commit 57ec6acd38
2 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -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;
}
+2 -2
View File
File diff suppressed because one or more lines are too long