1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-23 13:46:45 +02:00

fix: Correctly merge client application data in metrics aggregation

This commit is contained in:
unleash-bot 2025-07-02 14:41:54 +00:00
parent 2278089392
commit ca6c02cfdb

View File

@ -174,17 +174,16 @@ export default class ClientInstanceService {
const uniqueRegistrations = Object.values(this.seenClients);
const uniqueApps: Partial<IClientApplication>[] = Object.values(
uniqueRegistrations.reduce((soFar, reg) => {
let existingProjects = [];
if (soFar[`${reg.appName} ${reg.environment}`]) {
existingProjects =
soFar[`${reg.appName} ${reg.environment}`]
.projects || [];
}
soFar[`${reg.appName} ${reg.environment}`] = {
const key = `${reg.appName} ${reg.environment}`;
const existing = soFar[key] || {};
soFar[key] = {
...existing,
...reg,
projects: [
...existingProjects,
...(reg.projects || []),
...new Set([
...(existing.projects || []),
...(reg.projects || []),
]),
],
};
return soFar;