more stuff

This commit is contained in:
Boki 2026-10-20 20:11:40 -04:00
parent c3cb36c8d6
commit 7dec0be3b4
26 changed files with 1394 additions and 275 deletions

View file

@ -215,14 +215,16 @@ export function useBacktestV2(): UseBacktestV2Return {
}, [currentRun]);
const cancelRun = useCallback(async () => {
if (!currentRun || (currentRun.status !== 'running' && currentRun.status !== 'paused')) {
if (!currentRun || !['pending', 'running', 'paused'].includes(currentRun.status)) {
return;
}
try {
await backtestApiV2.cancelRun(currentRun.id);
setCurrentRun(prev => (prev ? { ...prev, status: 'cancelled' } : null));
stopMonitoringRun();
// Acceptance is not completion: keep monitoring the owner's persisted acknowledgement.
const updated = await backtestApiV2.getRun(currentRun.id);
setCurrentRun(updated);
setRuns(prev => prev.map(run => (run.id === updated.id ? updated : run)));
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to cancel run');
}