diff --git a/app/(prowler)/providers/page.tsx b/app/(prowler)/providers/page.tsx
index c49117fcd2..c6d380ccac 100644
--- a/app/(prowler)/providers/page.tsx
+++ b/app/(prowler)/providers/page.tsx
@@ -16,9 +16,13 @@ export default async function Providers({
}: {
searchParams?: {
query?: string;
- page: string;
+ page?: string;
+ sort?: string;
+ filter?: string;
};
}) {
+ const searchParamsKey = JSON.stringify(searchParams || {});
+
return (
<>
@@ -28,7 +32,7 @@ export default async function Providers({
- }>
+ }>
diff --git a/components/providers/table/DataTableColumnHeader.tsx b/components/providers/table/DataTableColumnHeader.tsx
index 6d460c5fb0..6051a3ef87 100644
--- a/components/providers/table/DataTableColumnHeader.tsx
+++ b/components/providers/table/DataTableColumnHeader.tsx
@@ -30,19 +30,15 @@ export const DataTableColumnHeader = ({
const currentSortParam = searchParams.get("sort");
let newSortParam = "";
- if (
- !currentSortParam ||
- currentSortParam === "" ||
- currentSortParam !== param
- ) {
- // Sort ascending for the first time or switch to a different column
- newSortParam = `${param}`;
- } else if (currentSortParam === param) {
+ if (currentSortParam === `${param}`) {
// If already sorting ascending, switch to descending
newSortParam = `-${param}`;
} else if (currentSortParam === `-${param}`) {
// If already sorting descending, remove sorting
newSortParam = "";
+ } else {
+ // Sort ascending for the first time or switch to a different column
+ newSortParam = `${param}`;
}
// Construct the new URL with the sorting parameter
@@ -76,7 +72,7 @@ export const DataTableColumnHeader = ({