fix(shell): stale tabs now know the gateway was updated
Recurring confusion all day: the SPA lives in an open tab until reload, so after a gateway rebuild/update users kept seeing (and benchmarking with!) an old interface — "where is the feature", "why are the test ids old". The meta endpoint now carries the process start timestamp; the existing 20s health poll compares it, and when the gateway has restarted the tab shows a fixed banner: "The gateway was updated — this page is running an older interface" with a one-click Reload. 2 strings in all 7 languages.
This commit is contained in:
@@ -600,8 +600,18 @@ async fn provider_models(
|
||||
}
|
||||
|
||||
async fn meta(State(state): State<SharedState>) -> ApiResult {
|
||||
// process start marker: open tabs poll this and offer a reload when the
|
||||
// gateway (and thus the embedded SPA) has been restarted/updated
|
||||
static STARTED: std::sync::OnceLock<u64> = std::sync::OnceLock::new();
|
||||
let started = *STARTED.get_or_init(|| {
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs()
|
||||
});
|
||||
ok(json!({
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"started": started,
|
||||
"update_available": state.gateway_update.lock().unwrap().clone(),
|
||||
"admin_open_public": state
|
||||
.admin_open_public
|
||||
|
||||
Reference in New Issue
Block a user