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.deepLink = false;
|
||||||
this.swInited = false;
|
this.swInited = false;
|
||||||
this.embed = null;
|
this.embed = null;
|
||||||
|
this.reloadCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@@ -188,11 +189,14 @@ Please try a different browser.\n
|
|||||||
const win = event.target.contentWindow;
|
const win = event.target.contentWindow;
|
||||||
const doc = event.target.contentDocument;
|
const doc = event.target.contentDocument;
|
||||||
|
|
||||||
if (win.navigator.serviceWorker && !win.navigator.serviceWorker.controller) {
|
if (win.navigator.serviceWorker && !win.navigator.serviceWorker.controller && this.reloadCount <= 2) {
|
||||||
setTimeout(() => window.location.reload(), 100);
|
this.reloadCount++;
|
||||||
|
setTimeout(() => win.location.reload(), 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.reloadCount = 0;
|
||||||
|
|
||||||
if (win.customElements.get("replay-app-main")) {
|
if (win.customElements.get("replay-app-main")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user