fix: improve building comment tree (#40)

As we build the map of nodes, keep track of the minimum depth level.
Afterwards, nodes at the minimum depth level go into the tree as the
roots.

We no longer need to check if the tree belongs to a parent comment or
not.

Fixes #36 more.
This commit is contained in:
Peter Bui authored and GitHub committed 2023-07-28 20:37:44 -07:00
1 parent 590eedc0fb
commit 9eb3665fa7
2 files changed
+10 -17

No files matched your search

@@ -59,7 +59,7 @@
return
}
const tree = buildCommentsTree(newComments.comments, false)
const tree = buildCommentsTree(newComments.comments, parent.depth)
// 0.18.2 -> 0.18.3 broke this
// so i'm adding this check