Revert built status from building in flowStore.ts

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-26 09:02:52 -03:00
commit 49df8e993d
2 changed files with 10 additions and 0 deletions

View file

@ -416,6 +416,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
useFlowStore.getState().updateBuildStatus(idList, BuildStatus.BUILDING);
},
});
get().revertBuiltStatusFromBuilding();
},
getFlow: () => {
return {
@ -445,6 +446,14 @@ const useFlowStore = create<FlowStoreType>((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;

View file

@ -90,4 +90,5 @@ export type FlowStoreType = {
removeFromVerticesBuild: (vertices: string[]) => void;
verticesBuild: string[];
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
revertBuiltStatusFromBuilding: () => void;
};