fix(ui): use server total for cron badge count on fresh load
The cron badge count used Math.max(meta.total, state.cronJobs.length) on every load, including fresh (non-paginated) loads. When a job was deleted between loads, the stale Math.max preserved the old higher count — badge showed 4 while list showed 3. Root cause: ui/src/ui/controllers/cron.ts:291. Math.max is correct for paginated appends (accumulating across pages) but wrong for fresh loads where the server total is authoritative. Fix: on fresh load (append=false) use meta.total directly; on paginated append keep Math.max to account for accumulation. Closes #51382 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: HCL <chenglunhu@gmail.com>
This commit is contained in:
parent
5e417b44e1
commit
f9a9aacc96
@ -288,7 +288,7 @@ export async function loadCronJobsPage(state: CronState, opts?: { append?: boole
|
||||
hasMoreRaw: res.hasMore,
|
||||
pageCount: jobs.length,
|
||||
});
|
||||
state.cronJobsTotal = Math.max(meta.total, state.cronJobs.length);
|
||||
state.cronJobsTotal = append ? Math.max(meta.total, state.cronJobs.length) : meta.total;
|
||||
state.cronJobsHasMore = meta.hasMore;
|
||||
state.cronJobsNextOffset = meta.nextOffset;
|
||||
if (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user