diff --git a/app/react/components/datatables/useTableState.ts b/app/react/components/datatables/useTableState.ts index daa01e51e..bd4d3957e 100644 --- a/app/react/components/datatables/useTableState.ts +++ b/app/react/components/datatables/useTableState.ts @@ -33,7 +33,8 @@ export function useTableStateWithStorage( } export function useTableStateWithoutStorage( - defaultSortKey?: string + defaultSortKey?: string, + defaultSortDesc: boolean = false ): BasicTableSettings & { setSearch: (search: string) => void; search: string; @@ -41,7 +42,7 @@ export function useTableStateWithoutStorage( const [search, setSearch] = useState(''); const [pageSize, setPageSize] = useState(10); const [sortBy, setSortBy] = useState( - defaultSortKey ? { id: defaultSortKey, desc: false } : undefined + defaultSortKey ? { id: defaultSortKey, desc: defaultSortDesc } : undefined ); return { diff --git a/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx b/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx index cae9d0702..240f29701 100644 --- a/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx +++ b/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx @@ -17,7 +17,7 @@ export function ActivityLogsView() { { start: Date; end: Date | null } | undefined >(undefined); const [page, setPage] = useState(0); - const tableState = useTableStateWithoutStorage('Timestamp'); + const tableState = useTableStateWithoutStorage('Timestamp', true); const offset = page * tableState.pageSize; const query = {