From f2334ec302270d031270d5f499dd53197491d5f5 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:58:27 +1000 Subject: [PATCH] fix(ui): reset node execution states on cancel --- .../web/src/features/nodes/store/nodesSlice.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts index c061e35c50..0837ded1cc 100644 --- a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts @@ -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; + } + }); + }); }, });