Skip to content

Commit

Permalink
Ignore empty partials coming from dynamic sources
Browse files Browse the repository at this point in the history
  • Loading branch information
krzksz committed Oct 10, 2024
1 parent 4e4c8cb commit 784a4b2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/utils/getProfileData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 784a4b2

Please sign in to comment.