From ebc205e71094483a066b991ef7faea60f81f4a08 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Wed, 19 Jul 2023 17:19:34 +0100 Subject: [PATCH] Filter explain subplan nodes without any data (Should fix #210 + #184) --- shared/studio/components/explainVis/state.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shared/studio/components/explainVis/state.ts b/shared/studio/components/explainVis/state.ts index 9ec09d8f..0a12d4f0 100644 --- a/shared/studio/components/explainVis/state.ts +++ b/shared/studio/components/explainVis/state.ts @@ -283,15 +283,17 @@ export function walkPlanNode( contexts: Contexts, planName: string | null = null ): Plan { - const subPlans: Plan[] = (data.children ?? []).map((child: any) => - walkPlanNode( - child.node, - queryTotalTime, - queryTotalCost, - contexts, - child.name - ) - ); + const subPlans: Plan[] = (data.children ?? []) + .filter((child: any) => child.node != null) + .map((child: any) => + walkPlanNode( + child.node, + queryTotalTime, + queryTotalCost, + contexts, + child.name + ) + ); const totalTime = data.actual_total_time !== undefined