Problem
`useAsync` intentionally clears `data` to `null` whenever a reload errors, "so we never render error + old rows":
```ts
} catch (err) {
setError(err);
setData(null); // never render error + old rows
} finally {
setLoading(false);
}
```
That's a reasonable default for a manual, user-triggered reload. But `JobRunner` calls `reload()` automatically every 4 seconds while a job is `running`, to show live progress:
```ts
useEffect(() => {
if (!isRunning) return;
const id = setInterval(reload, 4000);
return () => clearInterval(id);
}, [isRunning, reload]);
```
Impact
If one of those 4-second polls hits a transient error — an in-flight auth token refresh, a brief 5xx, a network hiccup — the entire jobs table disappears and is replaced by a bare error message. The admin loses visibility into the in-progress job's status/log until the next successful poll happens to fire and the table "flashes" back in. For a long-running seed/embedding job, this makes transient blips look like the job itself failed or the whole panel broke.
Location
`components/admin/useAsync.ts:39-42`, `components/admin/JobRunner.tsx:36-40`
Suggested fix
Give `useAsync` an option (e.g. `keepDataOnError`) to preserve the last-good `data` on background/polled reloads instead of clearing it, and have `JobRunner` opt into that mode for its interval-driven reloads while manual user-triggered reloads keep the current clear-on-error behavior.
Problem
`useAsync` intentionally clears `data` to `null` whenever a reload errors, "so we never render error + old rows":
```ts
} catch (err) {
setError(err);
setData(null); // never render error + old rows
} finally {
setLoading(false);
}
```
That's a reasonable default for a manual, user-triggered reload. But `JobRunner` calls `reload()` automatically every 4 seconds while a job is `running`, to show live progress:
```ts
useEffect(() => {
if (!isRunning) return;
const id = setInterval(reload, 4000);
return () => clearInterval(id);
}, [isRunning, reload]);
```
Impact
If one of those 4-second polls hits a transient error — an in-flight auth token refresh, a brief 5xx, a network hiccup — the entire jobs table disappears and is replaced by a bare error message. The admin loses visibility into the in-progress job's status/log until the next successful poll happens to fire and the table "flashes" back in. For a long-running seed/embedding job, this makes transient blips look like the job itself failed or the whole panel broke.
Location
`components/admin/useAsync.ts:39-42`, `components/admin/JobRunner.tsx:36-40`
Suggested fix
Give `useAsync` an option (e.g. `keepDataOnError`) to preserve the last-good `data` on background/polled reloads instead of clearing it, and have `JobRunner` opt into that mode for its interval-driven reloads while manual user-triggered reloads keep the current clear-on-error behavior.