Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Oct 25, 2023
1 parent 2febe75 commit d75ca04
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/components/cylc/gscan/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ export function sortedWorkflowTree (cylcTree) {
const tree = []
for (let node of cylcTree.children[0].children) {
node = flattenWorkflowParts(node)
// insert this workflow / workflow-part in sort order
tree.splice(
sortedIndexBy(tree, node, gscanWorkflowCompValue),
0,
node
)
if (node) {
// insert this workflow / workflow-part in sort order
tree.splice(
sortedIndexBy(tree, node, gscanWorkflowCompValue),
0,
node
)
}
}
return tree
}
Expand All @@ -89,7 +91,8 @@ export function sortedWorkflowTree (cylcTree) {
* E.g. foo, containing only run1, becomes foo/run1
*
* @param {Object} node
* @returns {Object} flattened node, or the original node if it has multiple children.
* @returns {Object=} flattened node, or the original node if it has multiple children.
* Warning: can be undefined if a workflow-part has no children (this can happen sometimes but should be transitory).
*/
export function flattenWorkflowParts (node) {
if (node.type !== 'workflow-part') {
Expand Down

0 comments on commit d75ca04

Please sign in to comment.