From 8ad59de9ce58473402bb7333db77c2f8b1dbdc17 Mon Sep 17 00:00:00 2001 From: mijovicmia <42170521+mijovicmia@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:25:22 +0000 Subject: [PATCH] Fix the bug in jobset sorting (#3418) --- internal/lookout/ui/src/hooks/useJobsTableData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lookout/ui/src/hooks/useJobsTableData.ts b/internal/lookout/ui/src/hooks/useJobsTableData.ts index 875ebf2b345..fd94c646964 100644 --- a/internal/lookout/ui/src/hooks/useJobsTableData.ts +++ b/internal/lookout/ui/src/hooks/useJobsTableData.ts @@ -130,7 +130,7 @@ function canOrderByField(lookoutFilters: JobFilter[], groupedColumns: string[], // Exclude column and everything after from groupedColumns for direct comparison const index = groupedColumns.findIndex((col) => col === id) - const filteredGroupedColumns = groupedColumns.slice(0, index) + const filteredGroupedColumns = index >= 0 ? groupedColumns.slice(0, index) : groupedColumns // Check if the lengths are different if (filterFields.length !== filteredGroupedColumns.length) {