Skip to content

Commit

Permalink
fixed more bugs with deleted nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgary committed Jun 23, 2021
1 parent fb52142 commit 9b742c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gatewayapps/ims-hub-services",
"version": "0.6.2",
"version": "0.6.3",
"main": "./dist/index.js",
"publishConfig": {
"access": "public"
Expand Down
8 changes: 7 additions & 1 deletion src/hubCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class HubCache {
node: ICachedNode,
excludedNodeIds: number[]
): number[] {
if (!node) {
return []
}

const result = node.descendantIds!.filter(
(id) =>
// Ensure none of this descendants ancestors appear in the exclusion list
Expand All @@ -67,7 +71,9 @@ export class HubCache {
treeId: number
): number[][] {
const distinctRoots = this.removeOverlappingRoots(rootNodeIds)
const finalRoots = distinctRoots.filter((rootId) => !excludedNodeIds.includes(rootId))
const finalRoots = distinctRoots.filter(
(rootId) => !excludedNodeIds.includes(rootId) && this.nodeHashMap[rootId]
)

const validDescendantArrays = finalRoots.map((root) =>
this.applyExclusionsToNodeDescendants(this.nodeHashMap[root], excludedNodeIds)
Expand Down

0 comments on commit 9b742c0

Please sign in to comment.