Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 712c8a87bcb691b5242651506ce8d355770a7c26
parent ca4d88137736c80d97098ec0ca04becaa52d0249
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 18 Nov 2026 01:50:45 -0500

jobs: the heading and controls are sent at once; the list streams in

The heading, Retry all failed, Clear logs, the pause and drain controls
and the render-mode banner come from memory and render first. The list
(the live head and a page of the history) streams in behind a skeleton
sized by how many rows are coming (one readdir).

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Meditor/app/jobs/page.tsx | 52++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/editor/app/jobs/page.tsx b/editor/app/jobs/page.tsx @@ -1,6 +1,10 @@ import type { Metadata } from "next"; +import { Suspense } from "react"; import Link from "next/link"; -import { DEFAULT_JOBS_LIMIT } from "yt-dlp-transcript-common/jobs/listJobs"; +import { + countAllJobs, + DEFAULT_JOBS_LIMIT, +} from "yt-dlp-transcript-common/jobs/listJobs"; import { getRegistry } from "yt-dlp-transcript-common/jobs/registry"; import { getWorkerPool } from "yt-dlp-transcript-common/jobs/workerPool"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; @@ -14,6 +18,8 @@ import { JobsTable } from "./components/JobsTable"; import { RenderModeBanner } from "./components/RenderModeBanner"; import { RetryAllFailedButton } from "./components/RetryAllFailedButton"; import { PauseLaneButton } from "../components/lanes/pauseControl"; +import { SkeletonPanel, StreamFilled } from "../components/StreamSkeleton"; +import { e2eStreamDelay } from "../lib/streamDelay"; export const dynamic = "force-dynamic"; @@ -35,22 +41,31 @@ function parseLimit(raw: string | string[] | undefined): number { return Math.min(Math.floor(n), MAX_JOBS_LIMIT); } +// What the skeleton is sized by, in px (e2e/streaming.spec.ts holds it to the +// box of what replaces it): the list with no job in it, the chrome above a +// table (the lane strip, the health line, the kind filters, the header row), +// and one row. +const JOBS_EMPTY_PX = 326; +const JOBS_CHROME_PX = 412; +const JOBS_ROW_PX = 62; + export default async function JobsPage({ searchParams, }: { searchParams: Promise<{ limit?: string | string[] }>; }) { const limit = parseLimit((await searchParams).limit); - const [{ rows, hasMore, total }, initial] = await Promise.all([ - listJobRows(getPaths(), { limit }), - buildActiveJobsPayload(), - ]); + // THE SHELL: the heading and the controls, from memory (the registry, the + // pool) and one readdir. The list itself — a page of sidecar reads and the + // live payload, which counts a running job's progress off the disk — streams + // in below, behind a skeleton sized by how many rows are coming. // Base the Retry-all affordance on the registry (what retryAllFailedAction // actually acts on), not just the loaded page. const hasRetryableFailed = getRegistry() .list() .some((j) => j.status === "failed" && Boolean(j.spec)); const paused = getWorkerPool().isPaused(); + const pending = Math.min(await countAllJobs(getPaths()), limit); return ( <div className="flex flex-col gap-4"> <div className="flex items-center justify-between"> @@ -65,6 +80,31 @@ export default async function JobsPage({ </div> </div> <RenderModeBanner /> + <Suspense + fallback={ + <SkeletonPanel + name="jobs-list" + height={ + pending === 0 ? JOBS_EMPTY_PX : JOBS_CHROME_PX + pending * JOBS_ROW_PX + } + /> + } + > + <JobsList limit={limit} /> + </Suspense> + </div> + ); +} + +// The list: the live head and one page of the history tail. +async function JobsList({ limit }: { limit: number }) { + await e2eStreamDelay(); + const [{ rows, hasMore, total }, initial] = await Promise.all([ + listJobRows(getPaths(), { limit }), + buildActiveJobsPayload(), + ]); + return ( + <StreamFilled name="jobs-list" className="flex flex-col gap-4"> <JobsTable initial={initial} history={rows} total={total} /> {hasMore && ( <div className="flex items-center justify-center gap-3 text-sm"> @@ -80,6 +120,6 @@ export default async function JobsPage({ </Link> </div> )} - </div> + </StreamFilled> ); }