diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 6e7b456f8..bc7a0fa72 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -872,7 +872,7 @@ export async function postBuildVertex( vertexId: string, input_value: string, ): Promise> { - return await api.post(`${BASE_URL_API}build/${flowId}/vertices/${vertexId}`, {inputs: {input_value: input_value}}); + return await api.post(`${BASE_URL_API}build/${flowId}/vertices/${vertexId}`, input_value ? {inputs: {input_value: input_value}} : undefined); } export async function downloadImage({ flowId, fileName }): Promise { diff --git a/src/frontend/src/utils/buildUtils.ts b/src/frontend/src/utils/buildUtils.ts index 8243a8e0d..b50c90b23 100644 --- a/src/frontend/src/utils/buildUtils.ts +++ b/src/frontend/src/utils/buildUtils.ts @@ -39,7 +39,7 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI { return inactiveVertexData; } -export async function updateVerticesOrder(flowId: string, nodeId: string | null) { +export async function updateVerticesOrder(flowId: string, nodeId: string | null): Promise<{ verticesLayers: string[][], verticesIds: string[], verticesOrder: string[][], runId: string }> { return new Promise(async (resolve, reject) => { const setErrorData = useAlertStore.getState().setErrorData; let orderResponse; @@ -80,6 +80,7 @@ export async function updateVerticesOrder(flowId: string, nodeId: string | null) useFlowStore .getState() .updateVerticesBuild({ verticesLayers, verticesIds, verticesOrder, runId }); + resolve({ verticesLayers, verticesIds, verticesOrder, runId }); }); } @@ -94,9 +95,9 @@ export async function buildVertices({ onBuildStart, validateNodes, }: BuildVerticesParams) { - const verticesBuild = useFlowStore.getState().verticesBuild; - if (!verticesBuild) { - await updateVerticesOrder(flowId, nodeId); + let verticesBuild = useFlowStore.getState().verticesBuild; + if (!verticesBuild || nodeId) { + verticesBuild = await updateVerticesOrder(flowId, nodeId); } const verticesIds = verticesBuild?.verticesIds!; const verticesLayers = verticesBuild?.verticesLayers!;