From 784a4b2a295b99a1d303f9401c43172769477ebc Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak Date: Thu, 10 Oct 2024 20:28:35 +0200 Subject: [PATCH] Ignore empty partials coming from dynamic sources --- src/utils/getProfileData.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/getProfileData.ts b/src/utils/getProfileData.ts index 0c01040..4b43f55 100644 --- a/src/utils/getProfileData.ts +++ b/src/utils/getProfileData.ts @@ -54,7 +54,11 @@ function requestAccessToken( function formatLiquidProfileData( entries: ProfileNode[], ): FormattedProfileNode[] { - return entries.map((entry: ProfileNode) => { + return entries.reduce((formattedEntries: FormattedProfileNode[], entry: ProfileNode) => { + if (!entry.partial) { + return formattedEntries; + } + const nameParts = entry.partial.split('/'); let name = ''; let filepath = null; @@ -78,15 +82,17 @@ function formatLiquidProfileData( }`; } - return { + formattedEntries.push({ name, filepath, value: entry.total_time, children: formatLiquidProfileData(entry.children), code: entry.code, line: entry.line_number, - }; - }); + }); + + return formattedEntries; + }, []); } function cleanProfileData(profileData: ProfileData) {