feat(lens): track active jobs before their first review

This commit is contained in:
Ishaan Jaff 2026-10-03 17:04:37 -07:00
parent d16b0d7132
commit b4ef33b7a1
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -222,8 +222,8 @@ describe("which job the live run shows", () => {
expect(liveJob([job("new", "running", [review("a")]), job("old", "completed", [review("b")])])?.id).toBe("new");
});
it("shows nothing for an active job with no reviews yet, even if an older job has some", () => {
expect(liveJob([job("new", "queued", []), job("old", "completed", [review("b")])])).toBeUndefined();
it("shows an active job before its first review so the wait is explained", () => {
expect(liveJob([job("new", "queued", []), job("old", "completed", [review("b")])])?.id).toBe("new");
});
it("keeps the latest finished job viewable only when it has reviews", () => {

View file

@ -32,7 +32,7 @@ const REPLAY_ON_OPEN = 3;
export function liveJob(jobs: readonly Job[]): Job | undefined {
const active = jobs.find((job) => job.status === "queued" || job.status === "running");
if (active) return active.reviews.length ? active : undefined;
if (active) return active;
const latest = jobs[0];
return latest?.reviews.length ? latest : undefined;
}