From 09065b8a78bbade1a1359cdcdf5e26b186067718 Mon Sep 17 00:00:00 2001 From: Brandon Cheng Date: Sat, 31 Dec 2022 02:53:07 -0500 Subject: [PATCH] fix(dependencies-hierarchy): fix resultHeight calculation This previously double incremented `resultHeight`. When writing this, I was thinking the child node's height was 1 more than the call for its dependencies. The parent node (the result) would then be more more than that. However, `resultHeight`'s definition is based the longest edge in the dependencies array returned, which doesn't include the parent node. The additional `+ 1` to account for the parent node should never have been added. --- reviewing/dependencies-hierarchy/src/getTree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reviewing/dependencies-hierarchy/src/getTree.ts b/reviewing/dependencies-hierarchy/src/getTree.ts index 1b6d312420..7d5eecdcce 100644 --- a/reviewing/dependencies-hierarchy/src/getTree.ts +++ b/reviewing/dependencies-hierarchy/src/getTree.ts @@ -119,7 +119,7 @@ function getTreeHelper ( const children = getChildrenTree(keypath.concat([relativeId]), relativeId) dependencies = children.dependencies const heightOfCurrentDepNode = children.height == null ? 0 : children.height + 1 - resultHeight = Math.max(resultHeight ?? 0, heightOfCurrentDepNode + 1) + resultHeight = Math.max(resultHeight ?? 0, heightOfCurrentDepNode) resultIsPartiallyVisited = resultIsPartiallyVisited || children.isPartiallyVisited if (children.circular) {