Refactor flowStore.ts to improve build success alert logic

This commit is contained in:
anovazzi1 2024-06-17 11:15:03 -03:00
commit 8f5c224283

View file

@ -542,15 +542,13 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
onBuildComplete: (allNodesValid) => {
const nodeId = startNodeId || stopNodeId;
if (!silent) {
if (nodeId && allNodesValid) {
if (allNodesValid) {
setSuccessData({
title: `${
title: nodeId?`${
get().nodes.find((node) => node.id === nodeId)?.data.node
?.display_name
} built successfully`,
} built successfully`:FLOW_BUILD_SUCCESS_ALERT,
});
} else {
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT });
}
}
get().setIsBuilding(false);