Geomap: Use set to order labels in reducer (#37509)

* shared location config

* shared locaiton config

* shared locaiton config

* remove file

* add alpha annotations

* chore: set is already ordered

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
An 2021-08-04 12:07:59 -04:00 committed by GitHub
parent 7323ba5ec1
commit 968817b151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,21 +156,17 @@ export function reduceSeriesToRows(
}
export function getDistinctLabelKeys(frames: DataFrame[]): string[] {
const ordered: string[] = [];
const keys = new Set<string>();
for (const frame of frames) {
for (const field of frame.fields) {
if (field.labels) {
for (const k of Object.keys(field.labels)) {
if (!keys.has(k)) {
ordered.push(k);
keys.add(k);
}
keys.add(k);
}
}
}
}
return ordered;
return [...keys];
}
/**