Skip to content

Commit

Permalink
fix: don't skip legacy children check when isParentNode=false (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
schottra authored Oct 22, 2020
1 parent c454229 commit ed6ede3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/Executions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface NodeInformation {

export interface ParentNodeExecution extends NodeExecution {
metadata: NodeExecutionMetadata & {
isParentNode: boolean;
isParentNode: true;
};
}

Expand Down
12 changes: 4 additions & 8 deletions src/components/Executions/useChildNodeExecutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useFetchableData } from 'components/hooks/useFetchableData';
import { isEqual } from 'lodash';
import {
Execution,
FilterOperationName,
NodeExecution,
RequestConfig,
TaskExecutionIdentifier,
Expand All @@ -13,7 +12,7 @@ import { useContext } from 'react';
import { ExecutionContext, ExecutionDataCacheContext } from './contexts';
import { formatRetryAttempt } from './TaskExecutionsList/utils';
import { ExecutionDataCache, NodeExecutionGroup } from './types';
import { hasParentNodeField } from './utils';
import { isParentNode } from './utils';

interface FetchGroupForTaskExecutionArgs {
config: RequestConfig;
Expand Down Expand Up @@ -164,12 +163,9 @@ export function useChildNodeExecutions({
};

// Newer NodeExecution structures can directly indicate their parent
// status and have their children fetched in bulk. If the field
// is present but false, we can just return an empty list.
if (hasParentNodeField(nodeExecution)) {
return nodeExecution.metadata.isParentNode
? fetchGroupsForParentNodeExecution(fetchArgs)
: [];
// status and have their children fetched in bulk.
if (isParentNode(nodeExecution)) {
return fetchGroupsForParentNodeExecution(fetchArgs);
}
// Otherwise, we need to determine the type of the node and
// recursively fetch NodeExecutions for the corresponding Workflow
Expand Down
10 changes: 3 additions & 7 deletions src/components/Executions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,12 @@ function getExecutionTimingMS({
return { duration: durationMS, queued: queuedMS };
}

/** Indicates the presence of metadata for parent node status. Older executions
* may be missing this field and require additional API calls to determine if
* their are children.
*/
export function hasParentNodeField(
/** Indicates if a NodeExecution is explicitly marked as a parent node. */
export function isParentNode(
nodeExecution: NodeExecution
): nodeExecution is ParentNodeExecution {
return (
nodeExecution.metadata != null &&
nodeExecution.metadata.isParentNode != null
nodeExecution.metadata != null && !!nodeExecution.metadata.isParentNode
);
}

Expand Down

0 comments on commit ed6ede3

Please sign in to comment.