import { useQuery } from '@tanstack/react-query'; import { Skeleton } from '#/components/atoms/skeleton.jsx'; import { checkLogUrl, readLog } from '#/lib/checks.js'; /** * A run's combined output. The blob is on the runner's PDS and is capped at a * megabyte by the runner, so it is fetched whole and shown in a scrolling box * rather than paged. * * The fetch starts only when the caller mounts this, which is what keeps a * page of runs from pulling every log at once. */ export function CheckLog({ runner, check }) { const cid = check.logs?.ref?.$link; const { data, error, isPending } = useQuery({ queryKey: ['check-log', runner?.did, cid], queryFn: () => readLog(runner, check), enabled: Boolean(cid), staleTime: Number.POSITIVE_INFINITY, }); if (!cid) { return (

This run published no log.

); } if (isPending) return ; if (error) { return (

{error.message}

); } return ( <>
        {data || 'The log is empty.'}
      
Raw log
); }