Pass the version in the updated param to attempt to cache bust (#21912)

pull/21958/head
James Salter 2022-04-25 14:15:21 +01:00 committed by GitHub
parent 691b8d5c38
commit 2ffb3a1180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -131,7 +131,7 @@ export default class WebPlatform extends VectorBasePlatform {
console.log("startUpdater, current version is " + this.getNormalizedAppVersion(process.env.VERSION)); console.log("startUpdater, current version is " + this.getNormalizedAppVersion(process.env.VERSION));
this.pollForUpdate((version: string, newVersion: string) => { this.pollForUpdate((version: string, newVersion: string) => {
const query = parseQs(location); const query = parseQs(location);
if (query.updated === "1") { if (query.updated) {
console.log("Update reloaded but still on an old version, stopping"); console.log("Update reloaded but still on an old version, stopping");
// We just reloaded already and are still on the old version! // We just reloaded already and are still on the old version!
// Show the toast rather than reload in a loop. // Show the toast rather than reload in a loop.
@ -139,10 +139,10 @@ export default class WebPlatform extends VectorBasePlatform {
return; return;
} }
// Set updated=1 as a query param so we can detect that we've already done this once // Set updated as a cachebusting query param and reload the page.
// and reload the page.
const url = new URL(window.location.href); const url = new URL(window.location.href);
url.searchParams.set("updated", "1"); url.searchParams.set("updated", newVersion);
console.log("Update reloading to " + url.toString());
window.location.href = url.toString(); window.location.href = url.toString();
}); });
setInterval(() => this.pollForUpdate(showUpdateToast, hideUpdateToast), POKE_RATE_MS); setInterval(() => this.pollForUpdate(showUpdateToast, hideUpdateToast), POKE_RATE_MS);