Clean up max-category front-end limit (#2347)

* remove topN category truncation from component rendering layer

* clean up category item limit implementation

* name change for clarity

* fix snapshot

* comments
This commit is contained in:
Bruce Martin
2021-07-29 16:05:10 -07:00
committed by GitHub
parent 27575b8d86
commit 8136387127
11 changed files with 215 additions and 167 deletions
+4 -9
View File
@@ -18,15 +18,11 @@ function caseInsensitiveCompare(a: any, b: any) {
return textA < textB ? -1 : textA > textB ? 1 : 0;
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
const catLabelSort = (isUserAnno: any, values: any) => {
const catLabelSort = (isUserAnno: boolean, values: any[]): any[] => {
/* this sort could be memoized for perf */
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const strings: any = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const ints: any = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
const strings: string[] = [];
const ints: number[] = [];
const unassignedOrNaN: any = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
@@ -43,11 +39,10 @@ const catLabelSort = (isUserAnno: any, values: any) => {
});
strings.sort(caseInsensitiveCompare);
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'a' implicitly has an 'any' type.
ints.sort((a, b) => +a - +b);
unassignedOrNaN.sort(caseInsensitiveCompare);
return ints.concat(strings, unassignedOrNaN);
return (<any>ints).concat(strings, unassignedOrNaN);
};
export default catLabelSort;