From 4783c39d7c16ae99f6f9b6d9162cf8ceea1fcbc7 Mon Sep 17 00:00:00 2001 From: Carina Ursu Date: Fri, 16 Jun 2023 16:55:17 -0700 Subject: [PATCH] chore: dparent null in alt paths (#775) Signed-off-by: Carina Ursu --- packages/console/package.json | 2 +- .../Executions/nodeExecutionQueries.ts | 29 ++++++++++++++----- .../console/src/components/common/utils.ts | 4 ++- website/package.json | 2 +- yarn.lock | 4 +-- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/console/package.json b/packages/console/package.json index 3806c16c0..e7f1381fe 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -1,6 +1,6 @@ { "name": "@flyteorg/console", - "version": "0.0.37", + "version": "0.0.38", "description": "Flyteconsole main app module", "main": "./dist/index.js", "module": "./lib/index.js", diff --git a/packages/console/src/components/Executions/nodeExecutionQueries.ts b/packages/console/src/components/Executions/nodeExecutionQueries.ts index 88d99fd88..e33edf9b9 100644 --- a/packages/console/src/components/Executions/nodeExecutionQueries.ts +++ b/packages/console/src/components/Executions/nodeExecutionQueries.ts @@ -64,13 +64,17 @@ export function makeNodeExecutionAndTasksQuery( id: NodeExecutionIdentifier, queryClient: QueryClient, dynamicParentNodeId?: string, -): QueryInput { +) { return { queryKey: [QueryType.NodeExecutionAndTasks, id], queryFn: async () => { // step 1: Fetch the Node execution const nodeExecutionPure = await getNodeExecution(id); + const dynamicParent = dynamicParentNodeId + ? await getNodeExecution({ ...id, nodeId: dynamicParentNodeId }) + : null; + // step 2: Fetch the task executions and attach them to the node execution const workflowNodeExecution = (await getTaskExecutions( queryClient, @@ -78,7 +82,7 @@ export function makeNodeExecutionAndTasksQuery( )) as WorkflowNodeExecution; if (!workflowNodeExecution) { - return {} as WorkflowNodeExecution; + return [{} as WorkflowNodeExecution]; } workflowNodeExecution.scopedId = workflowNodeExecution?.id?.nodeId; @@ -111,11 +115,22 @@ export function makeNodeExecutionAndTasksQuery( ), ); - return { - ...workflowNodeExecution, - taskExecutions: tasksExecutionData, - nodeExecutionData, - } as WorkflowNodeExecution; + const final = [ + { + ...workflowNodeExecution, + taskExecutions: tasksExecutionData, + nodeExecutionData, + } as WorkflowNodeExecution, + ]; + + if (dynamicParent) { + final.push({ + ...(dynamicParent as WorkflowNodeExecution), + scopedId: dynamicParentNodeId, + }); + } + + return final; }, }; } diff --git a/packages/console/src/components/common/utils.ts b/packages/console/src/components/common/utils.ts index 46bd4828b..f01a68a42 100644 --- a/packages/console/src/components/common/utils.ts +++ b/packages/console/src/components/common/utils.ts @@ -49,7 +49,9 @@ export const checkForDynamicExecutions = (allExecutions, staticExecutions) => { const result = {}; for (const parentId in parentsToFetch) { const execution = executionsByNodeId[parentId]; - result[execution.scopedId] = execution; + if (execution) { + result[execution.scopedId] = execution; + } } return result; }; diff --git a/website/package.json b/website/package.json index e5be2b48f..162608743 100644 --- a/website/package.json +++ b/website/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@flyteorg/common": "^0.0.4", - "@flyteorg/console": "^0.0.37", + "@flyteorg/console": "^0.0.38", "long": "^4.0.0", "protobufjs": "~6.11.3", "react-ga4": "^1.4.1", diff --git a/yarn.lock b/yarn.lock index e138ac749..7115ddb4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2020,7 +2020,7 @@ __metadata: resolution: "@flyteconsole/client-app@workspace:website" dependencies: "@flyteorg/common": ^0.0.4 - "@flyteorg/console": ^0.0.37 + "@flyteorg/console": ^0.0.38 "@types/long": ^3.0.32 long: ^4.0.0 protobufjs: ~6.11.3 @@ -2059,7 +2059,7 @@ __metadata: languageName: unknown linkType: soft -"@flyteorg/console@^0.0.37, @flyteorg/console@workspace:packages/console": +"@flyteorg/console@^0.0.38, @flyteorg/console@workspace:packages/console": version: 0.0.0-use.local resolution: "@flyteorg/console@workspace:packages/console" dependencies: