From e828e711e18a48a4df4dddd4ef31bee7dc9af47a Mon Sep 17 00:00:00 2001 From: Hjalmers Date: Tue, 22 Oct 2024 07:30:42 +0200 Subject: [PATCH] fix(table-sort): handle null and equal values --- projects/core/src/lib/utilities/utilities.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/core/src/lib/utilities/utilities.ts b/projects/core/src/lib/utilities/utilities.ts index cbe8e7b..cf1f506 100644 --- a/projects/core/src/lib/utilities/utilities.ts +++ b/projects/core/src/lib/utilities/utilities.ts @@ -176,6 +176,9 @@ export const sortOnMultipleKeys = ( return (a, b) => { for (let i = 0; i < keys.length; i++) { const o = keys[i].key; + if (a[o] === b[o]) return 0; + if (a[o] === null) return 1; + if (b[o] === null) return -1; if (a[o] > b[o]) return order[i]; if (a[o] < b[o]) return -order[i]; }