Refactor variable names and fix typo in code

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-01 17:13:20 -03:00
commit 74b723c4da
7 changed files with 36 additions and 28 deletions

View file

@ -219,8 +219,16 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
);
},
paste: (selection, position) => {
if(selection.nodes.some((node) => node.data.type === "ChatInput") && checkChatInput(get().nodes)){
useAlertStore.getState().setErrorData({title: "Error pasting components", list: ["You can only have one ChatInput component in the flow"]});
if (
selection.nodes.some((node) => node.data.type === "ChatInput") &&
checkChatInput(get().nodes)
) {
useAlertStore
.getState()
.setErrorData({
title: "Error pasting components",
list: ["You can only have one ChatInput component in the flow"],
});
return;
}
let minimumX = Infinity;
@ -440,8 +448,8 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
status: BuildStatus,
buildId: string
) {
if (vertexBuildData && vertexBuildData.inactive_vertices) {
get().removeFromVerticesBuild(vertexBuildData.inactive_vertices);
if (vertexBuildData && vertexBuildData.inactivated_vertices) {
get().removeFromVerticesBuild(vertexBuildData.inactivated_vertices);
}
get().addDataToFlowPool(
{ ...vertexBuildData, buildId },

View file

@ -140,7 +140,7 @@ export type VerticesOrderTypeAPI = {
export type VertexBuildTypeAPI = {
id: string;
inactive_vertices: Array<string> | null;
inactivated_vertices: Array<string> | null;
valid: boolean;
params: string;
data: VertexDataTypeAPI;

View file

@ -31,7 +31,7 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI {
id: vertexId,
data: inactiveData,
params: "Inactive",
inactive_vertices: null,
inactivated_vertices: null,
valid: false,
timestamp: new Date().toISOString(),
};
@ -85,14 +85,12 @@ export async function updateVerticesOrder(
}
const verticesIds = verticesLayers.flat();
useFlowStore
.getState()
.updateVerticesBuild({
verticesLayers,
verticesIds,
verticesOrder,
runId,
});
useFlowStore.getState().updateVerticesBuild({
verticesLayers,
verticesIds,
verticesOrder,
runId,
});
resolve({ verticesLayers, verticesIds, verticesOrder, runId });
});
}