Skip to content

Commit

Permalink
Pass the version in the updated param to attempt to cache bust (#21912)
Browse files Browse the repository at this point in the history
  • Loading branch information
novocaine authored Apr 25, 2022
1 parent 691b8d5 commit 2ffb3a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vector/platform/WebPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ export default class WebPlatform extends VectorBasePlatform {
console.log("startUpdater, current version is " + this.getNormalizedAppVersion(process.env.VERSION));
this.pollForUpdate((version: string, newVersion: string) => {
const query = parseQs(location);
if (query.updated === "1") {
if (query.updated) {
console.log("Update reloaded but still on an old version, stopping");
// We just reloaded already and are still on the old version!
// Show the toast rather than reload in a loop.
showUpdateToast(version, newVersion);
return;
}

// Set updated=1 as a query param so we can detect that we've already done this once
// and reload the page.
// Set updated as a cachebusting query param and reload the page.
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();
});
setInterval(() => this.pollForUpdate(showUpdateToast, hideUpdateToast), POKE_RATE_MS);
Expand Down

0 comments on commit 2ffb3a1

Please sign in to comment.