Fix issue where gpu sometimes doesnt show on caption modal

This commit is contained in:
Jaret Burkett
2026-06-18 09:37:59 -06:00
parent ad49d4ef25
commit e8c828089a

View File

@@ -44,5 +44,15 @@ export default function useGPUInfo(gpuIds: null | number[] = null, reloadInterva
}
}, [gpuIds, reloadInterval]); // Added dependencies
// If the initial fetch failed (e.g. nvidia-smi was transiently busy on startup),
// retry automatically so users don't have to reload the page to see their GPUs.
useEffect(() => {
if (status !== 'error') return;
const retry = setTimeout(() => {
fetchGpuInfo();
}, 3000);
return () => clearTimeout(retry);
}, [status]);
return { gpuList, setGpuList, isGPUInfoLoaded, status, refreshGpuInfo: fetchGpuInfo };
}