Have the refresh button check for a new build too
The version poller already diffs /api/version against the manifest captured at boot -- hot-swapping changed CSS, reloading for changed JS/HTML once playback allows -- but only on its own 60s tick or when the tab regains visibility. Pressing refresh now runs that same check in the background, so a tab left open across a deploy picks the new build up when the user asks for fresh content rather than up to a minute later. App.version.checkNow() exposes it; with no baseline (the endpoint was down at boot) it just adopts the current manifest, since there is nothing to compare against yet. Verified against the running app: appending to style.css and pressing refresh swapped the tag to style.css?v=<hash> with the page still alive, and appending to a .js file reloaded the page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QBDkEXP4htyXTCZUwMLphd
This commit is contained in:
@@ -114,6 +114,21 @@ App.version = App.version || {};
|
||||
}
|
||||
}
|
||||
|
||||
// Same check the poller runs, on demand: the top-bar refresh button asks for
|
||||
// it so a tab left open across a deploy picks the new build up right then,
|
||||
// rather than up to POLL_INTERVAL_MS later. Changed CSS hot-swaps; changed
|
||||
// JS/HTML reloads as soon as that won't interrupt playback.
|
||||
App.version.checkNow = function() {
|
||||
if (!baseline) {
|
||||
// start() never got a manifest (endpoint down, or it hasn't run
|
||||
// yet). Adopt whatever the server reports now so there's something
|
||||
// to diff against next time -- there's no baseline to compare this
|
||||
// one against, so nothing can be concluded from it today.
|
||||
return fetchVersion().then((latest) => { baseline = latest; }).catch(() => {});
|
||||
}
|
||||
return check();
|
||||
};
|
||||
|
||||
App.version.start = async function() {
|
||||
try {
|
||||
baseline = await fetchVersion();
|
||||
|
||||
Reference in New Issue
Block a user