Revert built status from building in flowStore.ts
This commit is contained in:
parent
bbf2a1690a
commit
49df8e993d
2 changed files with 10 additions and 0 deletions
|
|
@ -416,6 +416,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
useFlowStore.getState().updateBuildStatus(idList, BuildStatus.BUILDING);
|
useFlowStore.getState().updateBuildStatus(idList, BuildStatus.BUILDING);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
get().revertBuiltStatusFromBuilding();
|
||||||
},
|
},
|
||||||
getFlow: () => {
|
getFlow: () => {
|
||||||
return {
|
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;
|
export default useFlowStore;
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,5 @@ export type FlowStoreType = {
|
||||||
removeFromVerticesBuild: (vertices: string[]) => void;
|
removeFromVerticesBuild: (vertices: string[]) => void;
|
||||||
verticesBuild: string[];
|
verticesBuild: string[];
|
||||||
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
|
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
|
||||||
|
revertBuiltStatusFromBuilding: () => void;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue