From 20d9ca92f928b75c462917217e55a683c117fdb0 Mon Sep 17 00:00:00 2001 From: apanizo Date: Wed, 24 Oct 2018 12:14:48 +0200 Subject: [PATCH] Fix duplicated values when fixed sorting --- src/components/Table/sorting.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Table/sorting.js b/src/components/Table/sorting.js index 65bd28f5..dbb5152a 100644 --- a/src/components/Table/sorting.js +++ b/src/components/Table/sorting.js @@ -23,7 +23,8 @@ const desc = (a: Object, b: Object, orderBy: string, orderProp: boolean) => { export const stableSort = (array: any, cmp: any, fixed: boolean) => { const fixedElems = fixed ? array.filter(elem => elem[FIXED]) : [] - const stabilizedThis = array.map((el, index) => [el, index]) + const data = fixed ? array.filter(elem => !elem[FIXED]) : array + const stabilizedThis = data.map((el, index) => [el, index]) stabilizedThis.sort((a, b) => { const order = cmp(a[0], b[0])