Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud committed Jan 26, 2021
1 parent 943ab9c commit 8ae7f07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions packages/superset-ui-core/src/query/extractQueryFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export default function extractQueryFields(
}
if (normalizedKey === 'metrics') {
finalQueryFields[normalizedKey] = finalQueryFields[normalizedKey].concat(value);
}
if (normalizedKey === 'columns') {
} else if (normalizedKey === 'columns') {
// currently the columns field only accept pre-defined columns (string shortcut)
finalQueryFields[normalizedKey] = finalQueryFields[normalizedKey]
.concat(value)
Expand Down
18 changes: 9 additions & 9 deletions packages/superset-ui-core/src/utils/removeDuplicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
* Remove duplicate items from a list.
*/
export function removeDuplicates<T>(items: T[], hash?: (item: T) => unknown): T[] {
const seen = new Set();
const result: T[] = [];
items.forEach(x => {
const itemHash = hash ? hash(x) : x;
if (!seen.has(itemHash)) {
if (hash) {
const seen = new Set();
return items.filter(x => {
const itemHash = hash(x);
if (seen.has(itemHash)) return false;
seen.add(itemHash);
result.push(x);
}
});
return result;
return true;
});
}
return [...new Set(items)];
}

export default removeDuplicates;

0 comments on commit 8ae7f07

Please sign in to comment.