[READ-ONLY] Mirror of https://github.com/improsocial/impro An extensible Bluesky client for web impro.social
6

Configure Feed

Select the types of activity you want to include in your feed.

Load new version when available

Grace Kind (Jul 7, 2026, 4:59 PM -0500) 2a90f211 164001cc

+61 -1
+1 -1
package.json
··· 1 1 { 2 2 "name": "impro", 3 - "version": "0.17.108", 3 + "version": "0.17.109", 4 4 "type": "module", 5 5 "scripts": { 6 6 "start": "rm -rf \"${BUILD_DIR:-build}\" && NODE_ENV=development eleventy --serve",
+49
src/index.html
··· 52 52 import { enableErrorLogs } from "/js/errorLogs.js"; 53 53 import "/js/perf.js"; 54 54 55 + // Reload when a newer version is deployed 56 + const RELOAD_GUARD_KEY = "version-check-last-reload"; 57 + const RELOAD_GUARD_MS = 60 * 1000; 58 + 59 + async function fetchDeployedVersion() { 60 + try { 61 + const response = await fetch("/version.json", { cache: "no-store" }); 62 + if (!response.ok) { 63 + return null; 64 + } 65 + const data = await response.json(); 66 + return data.version ?? null; 67 + } catch { 68 + return null; 69 + } 70 + } 71 + 72 + async function reloadIfOutdated() { 73 + const deployedVersion = await fetchDeployedVersion(); 74 + if ( 75 + deployedVersion === null || 76 + deployedVersion === window.env.version 77 + ) { 78 + return; 79 + } 80 + // Guard against a reload loop if the server keeps returning stale HTML 81 + const lastReload = Number(sessionStorage.getItem(RELOAD_GUARD_KEY)); 82 + if (lastReload && Date.now() - lastReload < RELOAD_GUARD_MS) { 83 + console.warn( 84 + `Deployed version ${deployedVersion} differs from running version ${window.env.version}, but a reload was already attempted recently - skipping`, 85 + ); 86 + return; 87 + } 88 + sessionStorage.setItem(RELOAD_GUARD_KEY, String(Date.now())); 89 + window.location.reload(); 90 + } 91 + 92 + reloadIfOutdated(); 93 + window.addEventListener("visibilitychange", () => { 94 + if (document.visibilityState === "visible") { 95 + reloadIfOutdated(); 96 + } 97 + }); 98 + window.addEventListener("pageshow", (event) => { 99 + if (event.persisted) { 100 + reloadIfOutdated(); 101 + } 102 + }); 103 + 55 104 const params = new URLSearchParams(window.location.search); 56 105 57 106 // Dev tools
+11
src/version.11ty.js
··· 1 + export default { 2 + data() { 3 + return { 4 + permalink: "/version.json", 5 + }; 6 + }, 7 + 8 + render(data) { 9 + return JSON.stringify({ version: data.version }, null, 2); 10 + }, 11 + };