Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't skip legacy children check when isParentNode=false #111

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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