From 49df8e993d724ec2b5f4e06c01e3b6252da0d0eb Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 26 Feb 2024 09:02:52 -0300 Subject: [PATCH] Revert built status from building in flowStore.ts --- src/frontend/src/stores/flowStore.ts | 9 +++++++++ src/frontend/src/types/zustand/flow/index.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index e44a66554..83dabd3fd 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -416,6 +416,7 @@ const useFlowStore = create((set, get) => ({ useFlowStore.getState().updateBuildStatus(idList, BuildStatus.BUILDING); }, }); + get().revertBuiltStatusFromBuilding(); }, getFlow: () => { return { @@ -445,6 +446,14 @@ const useFlowStore = create((set, get) => ({ } }); }, + revertBuiltStatusFromBuilding: () => { + get().nodes.forEach((node) => { + if (node.data.buildStatus === BuildStatus.BUILDING) { + node.data.buildStatus = BuildStatus.TO_BUILD; + } + }); + set({ nodes: get().nodes }); + }, })); export default useFlowStore; diff --git a/src/frontend/src/types/zustand/flow/index.ts b/src/frontend/src/types/zustand/flow/index.ts index feaff49f5..2b4e8f251 100644 --- a/src/frontend/src/types/zustand/flow/index.ts +++ b/src/frontend/src/types/zustand/flow/index.ts @@ -90,4 +90,5 @@ export type FlowStoreType = { removeFromVerticesBuild: (vertices: string[]) => void; verticesBuild: string[]; updateBuildStatus: (nodeId: string[], status: BuildStatus) => void; + revertBuiltStatusFromBuilding: () => void; };