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) {