From a03d4573feeb239fec768535970ee156930ab315 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 1 Mar 2024 16:25:14 -0300 Subject: [PATCH] Fix issue with updating vertices order --- src/frontend/src/utils/buildUtils.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/utils/buildUtils.ts b/src/frontend/src/utils/buildUtils.ts index 48fde82c2..9968baf7e 100644 --- a/src/frontend/src/utils/buildUtils.ts +++ b/src/frontend/src/utils/buildUtils.ts @@ -63,7 +63,21 @@ export async function updateVerticesOrder( } let verticesLayers: Array> = orderResponse.data.ids; const runId = orderResponse.data.run_id; - + if (nodeId) { + for (let i = 0; i < verticesLayers.length; i += 1) { + const innerArray = verticesLayers[i]; + const idIndex = innerArray.indexOf(nodeId); + if (idIndex !== -1) { + // If there's a nodeId, we want to run just that component and not the entire layer + // because a layer contains dependencies for the next layer + // and we are stopping at the layer that contains the nodeId + verticesLayers.push([innerArray[idIndex]]); + break; // Stop searching after finding the first occurrence + } + // If the targetId is not found, include the entire inner array + verticesLayers.push(innerArray); + } + } const verticesIds = verticesLayers.flat(); useFlowStore.getState().updateVerticesBuild({ verticesLayers,