Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

chore: use toggle order

Scott Wilsoncf5f49d14ede
diff --git a/frontend/src/hooks/usePagination.tsx b/frontend/src/hooks/usePagination.tsx
index b89a4f92cf..e4c9fddbb9 100644
--- a/frontend/src/hooks/usePagination.tsx
+++ b/frontend/src/hooks/usePagination.tsx
@@ -33,6 +33,10 @@ export const usePagination = <T extends string>(
search,
setSearch,
orderBy,
- setOrderBy
+ setOrderBy,
+ toggleOrderDirection: () =>
+ setOrderDirection((prev) =>
+ prev === OrderByDirection.DESC ? OrderByDirection.ASC : OrderByDirection.DESC
+ )
};
};
diff --git a/frontend/src/pages/org/[id]/overview/index.tsx b/frontend/src/pages/org/[id]/overview/index.tsx
index ed5b13100d..45fc7f3d2b 100644
--- a/frontend/src/pages/org/[id]/overview/index.tsx
+++ b/frontend/src/pages/org/[id]/overview/index.tsx
@@ -514,8 +514,16 @@ const OrganizationPage = () => {
const isWorkspaceEmpty = !isProjectViewLoading && orgWorkspaces?.length === 0;
- const { setPage, perPage, setPerPage, page, offset, limit, setOrderDirection, orderDirection } =
- usePagination(ProjectOrderBy.Name, { initPerPage: 24 });
+ const {
+ setPage,
+ perPage,
+ setPerPage,
+ page,
+ offset,
+ limit,
+ toggleOrderDirection,
+ orderDirection
+ } = usePagination(ProjectOrderBy.Name, { initPerPage: 24 });
const filteredWorkspaces = useMemo(
() =>
@@ -805,11 +813,7 @@ const OrganizationPage = () => {
variant="plain"
size="xs"
colorSchema="secondary"
- onClick={() =>
- setOrderDirection((prev) =>
- prev === OrderByDirection.ASC ? OrderByDirection.DESC : OrderByDirection.ASC
- )
- }
+ onClick={toggleOrderDirection}
>
<FontAwesomeIcon
icon={orderDirection === OrderByDirection.ASC ? faArrowDownAZ : faArrowUpZA}