fix(ui): reset node execution states on cancel

This commit is contained in:
psychedelicious 2023-08-30 18:58:27 +10:00
parent 044d4c107a
commit f2334ec302

View File

@ -1,5 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { cloneDeep, forEach, isEqual, uniqBy } from 'lodash-es';
import { cloneDeep, forEach, isEqual, map, uniqBy } from 'lodash-es';
import {
addEdge,
applyEdgeChanges,
@ -18,7 +18,7 @@ import {
Viewport,
} from 'reactflow';
import { receivedOpenAPISchema } from 'services/api/thunks/schema';
import { sessionInvoked } from 'services/api/thunks/session';
import { sessionCanceled, sessionInvoked } from 'services/api/thunks/session';
import { ImageField } from 'services/api/types';
import {
appSocketGeneratorProgress,
@ -818,6 +818,13 @@ const nodesSlice = createSlice({
nes.outputs = [];
});
});
builder.addCase(sessionCanceled.fulfilled, (state) => {
map(state.nodeExecutionStates, (nes) => {
if (nes.status === NodeStatus.IN_PROGRESS) {
nes.status = NodeStatus.PENDING;
}
});
});
},
});