mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-07 18:27:45 +02:00
[eric] workflows: header counted 0 over a real workflow, monitor claimed a schedule while paused, restore lost run history
This commit is contained in:
@@ -414,9 +414,12 @@ export const fetchDeletedWorkflows = createAsyncThunk('workflows/fetchDeleted',
|
||||
return data.workflows as Workflow[];
|
||||
});
|
||||
|
||||
export const restoreWorkflow = createAsyncThunk('workflows/restore', async (id: string) => {
|
||||
export const restoreWorkflow = createAsyncThunk('workflows/restore', async (id: string, { dispatch }) => {
|
||||
const res = await fetch(`${API}/${id}/restore`, { method: 'POST' });
|
||||
if (!res.ok) throw new Error(`restore failed ${res.status}`);
|
||||
// Trashing drops the run rows from the store; the server kept them, so pull them back or a restored workflow claims "No runs yet" over a real history.
|
||||
void dispatch(fetchRuns(id));
|
||||
void dispatch(fetchAllRuns(200));
|
||||
return (await res.json()) as Workflow;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user