From 0e4a5a6adfdf517c3dc39792b87b5d10a23f58c9 Mon Sep 17 00:00:00 2001 From: oatkiller Date: Thu, 9 Jan 2020 12:12:41 -0500 Subject: [PATCH] more elite code --- .../resolver/store/data/selectors.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/store/data/selectors.ts b/x-pack/plugins/endpoint/public/embeddables/resolver/store/data/selectors.ts index 0d499e1112a19b5..1580580f0fc0c05 100644 --- a/x-pack/plugins/endpoint/public/embeddables/resolver/store/data/selectors.ts +++ b/x-pack/plugins/endpoint/public/embeddables/resolver/store/data/selectors.ts @@ -102,18 +102,20 @@ function widthsOfProcessSubtrees(indexedProcessTree: IndexedProcessTree): Proces return widths; } -// bet sean loves this +/** + * TODO comments + */ type ProcessWithWidthMetadata = { process: ProcessEvent; width: number; } & ( - | ({ + | { parent: ProcessEvent; parentWidth: number; - } & ( // TODO bolete this - | { isOnlyChild: true; firstChildWidth: null; lastChildWidth: null } - | { isOnlyChild: false; firstChildWidth: number; lastChildWidth: number } - )) + isOnlyChild: boolean; + firstChildWidth: number; + lastChildWidth: number; + } | { parent: null; /* Without a parent, there is no parent width */ @@ -272,9 +274,8 @@ function* levelOrderWithWidths( const siblings = indexedProcessTreeChildren(tree, parent); if (siblings.length === 1) { metadata.isOnlyChild = true; - // TODO, just make these === width - metadata.lastChildWidth = null; - metadata.firstChildWidth = null; + metadata.lastChildWidth = width; + metadata.firstChildWidth = width; } else { const firstChildWidth = widths.get(siblings[0]); const lastChildWidth = widths.get(siblings[0]);