Skip to content

Commit

Permalink
Copy over the profile meta when merging profiles (#5131)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatum authored Oct 16, 2024
1 parent d12a3a0 commit 1170042
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/profile-logic/merge-compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ export function mergeProfilesForDiffing(
}

const resultProfile = getEmptyProfile();

// Copy over identical values for the ProfileMeta.
for (const [key, value] of Object.entries(profiles[0].meta)) {
if (profiles.every((profile) => profile.meta[key] === value)) {
resultProfile.meta[key] = value;
}
}
// Ensure it has a copy of the marker schema and categories, even though these could
// be different between the two profiles.
resultProfile.meta.markerSchema = profiles[0].meta.markerSchema;
resultProfile.meta.categories = profiles[0].meta.categories;

resultProfile.meta.interval = Math.min(
...profiles.map((profile) => profile.meta.interval)
);
Expand Down

0 comments on commit 1170042

Please sign in to comment.