()
| 34 | const index = diagnosis?.reading.index ?? coverage; |
| 35 | const records = useMemo(() => diagnosticRecords(index), [index]); |
| 36 | const run = async () => { |
| 37 | const ticket = ++request.current; |
| 38 | setBusy(true); setError(null); setStatus(''); |
| 39 | try { |
| 40 | const reading = await loadCoverage(client, project); |
| 41 | if (ticket !== request.current) return; |
| 42 | const pathAnswer = path ? await loadPathCoverage(client, project, path) : undefined; |
| 43 | if (ticket !== request.current) return; |
| 44 | const result: LocalDiagnosis = { project, requestedPath: path, checkedAt: new Date().toISOString(), reading, pathAnswer }; |
| 45 | setDiagnosis(result); setReport(localDiagnosticReport(result)); onCoverage?.(reading); |
| 46 | } catch (reason) { |
| 47 | if (ticket === request.current) setError(reason instanceof Error ? reason.message : String(reason)); |
| 48 | } finally { |
| 49 | if (ticket === request.current) setBusy(false); |
| 50 | } |
| 51 | }; |
| 52 | const copy = async () => { |
| 53 | try { |
| 54 | if (!navigator.clipboard?.writeText) throw new Error('Clipboard unavailable; select the draft and copy it manually.'); |
no test coverage detected