fix: hide stale update failures on status load

This commit is contained in:
Qiufeng
2026-09-04 01:08:46 +08:00
parent a61860fcb3
commit 704740182a
3 changed files with 35 additions and 4 deletions
+8 -2
View File
@@ -338,7 +338,10 @@ export default function UpdatePage({
else setLoading(false);
}, [isMock]);
const job = info?.job;
// The status endpoint intentionally hides terminal failures/cancellations.
// Keep this guard in the UI as well so a stale response from an older
// server cannot turn a fresh page visit into a false failure state.
const job = info?.job && info.job.status !== "failed" && info.job.status !== "cancelled" ? info.job : null;
useEffect(() => {
if (job && activeStatuses.has(job.status)) setShowPipelineDialog(true);
}, [job?.id, job?.status]);
@@ -441,7 +444,10 @@ export default function UpdatePage({
method: "POST",
body: "{}",
});
setLiveInfo((current) => ({ ...result, job: result.job ?? current?.job ?? null }));
setLiveInfo((current) => ({
...result,
job: result.job ?? (current?.job && activeStatuses.has(current.job.status) ? current.job : null),
}));
notify?.(result.latest?.isNewer ? "发现新版本" : "当前已是最新版本", "success");
} catch (caught) {
if (caught instanceof ApiError && caught.code === "UPDATE_RATE_LIMITED") {