Skip to content

Commit

Permalink
fix: checkForDynamicExecutions
Browse files Browse the repository at this point in the history
  • Loading branch information
james-union committed Feb 7, 2023
1 parent 42d2e25 commit 450d144
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/console/src/components/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ export function measureText(fontDefinition: string, text: string) {
*/
export const checkForDynamicExecutions = (allExecutions, staticExecutions) => {
const parentsToFetch = {};
const executionsByNodeId = {};
for (const executionId in allExecutions) {
const execution = allExecutions[executionId];
executionsByNodeId[execution.id.nodeId] = execution;
if (!staticExecutions[executionId]) {
const dynamicExecution = allExecutions[executionId];
if (dynamicExecution) {
if (execution) {
const dynamicExecutionId =
dynamicExecution.metadata?.specNodeId || dynamicExecution.id;
const uniqueParentId = dynamicExecution.fromUniqueParentId;
execution.metadata?.specNodeId || execution.id;
const uniqueParentId = execution.fromUniqueParentId;
if (uniqueParentId) {
if (parentsToFetch[uniqueParentId]) {
parentsToFetch[uniqueParentId].push(dynamicExecutionId);
Expand All @@ -46,7 +48,8 @@ export const checkForDynamicExecutions = (allExecutions, staticExecutions) => {
}
const result = {};
for (const parentId in parentsToFetch) {
result[parentId] = allExecutions[parentId];
const execution = executionsByNodeId[parentId];
result[execution.scopedId] = execution;
}
return result;
};

0 comments on commit 450d144

Please sign in to comment.