Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina committed May 4, 2022
1 parent c3798ea commit ad9d9b4
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface BuildDataProps {
rootParentNode: dNode;
currentNestedView: string[];
}
export const buildReactFlowDataProps = (props: BuildDataProps) => {
const buildReactFlowDataProps = (props: BuildDataProps) => {
const {
node,
nodeExecutionsById,
Expand All @@ -61,12 +61,12 @@ export const buildReactFlowDataProps = (props: BuildDataProps) => {
currentNestedView,
} = props;

const { value: nodeValue, name: displayName, scopedId, type: nodeType } = node || {};
const { value: nodeValue, name: displayName, scopedId, type: nodeType } = node;
const taskType = nodeValue?.template?.type ?? null;

const mapNodeExecutionStatus = () => {
if (nodeExecutionsById) {
if (nodeExecutionsById?.[scopedId]) {
if (nodeExecutionsById[scopedId]) {
return nodeExecutionsById[scopedId].closure.phase as NodeExecutionPhase;
} else {
return NodeExecutionPhase.SKIPPED;
Expand All @@ -77,8 +77,9 @@ export const buildReactFlowDataProps = (props: BuildDataProps) => {
};
const nodeExecutionStatus = mapNodeExecutionStatus();

// nodeExecutionsById null check is required as on first render it can be undefined
const cacheStatus: CatalogCacheStatus =
nodeExecutionsById?.[scopedId]?.closure?.taskNodeMetadata?.cacheStatus ??
nodeExecutionsById?.[scopedId]?.closure.taskNodeMetadata?.cacheStatus ??
CatalogCacheStatus.CACHE_DISABLED;

const dataProps = {
Expand All @@ -96,7 +97,7 @@ export const buildReactFlowDataProps = (props: BuildDataProps) => {
},
onAddNestedView: () => {
onAddNestedView({
parent: rootParentNode?.scopedId,
parent: rootParentNode.scopedId,
view: scopedId,
});
},
Expand All @@ -119,7 +120,7 @@ interface BuildNodeProps {
parentNode?: dNode;
typeOverride?: dTypes;
}
export const buildReactFlowNode = ({
const buildReactFlowNode = ({
node,
dataProps,
rootParentNode,
Expand Down Expand Up @@ -214,7 +215,7 @@ export const buildGraphMapping = (props): ReactFlowGraphMapping => {
const parse = (props: ParseProps) => {
const { contextNode, contextParent, rootParentNode, nodeDataProps } = props;
let context: ReactFlowGraph | null = null;
contextNode.nodes.map((node: dNode) => {
contextNode.nodes.filter(n => !!n).map((node: dNode) => {
/* Case: node has children => recurse */
if (nodeHasChildren(node)) {
if (rootParentNode) {
Expand Down

0 comments on commit ad9d9b4

Please sign in to comment.