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.
This commit is contained in:
Brandon Cheng
2022-12-31 02:53:07 -05:00
committed by Zoltan Kochan
parent 35fea5ea74
commit 09065b8a78

View File

@@ -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) {