Skip to content
Snippets Groups Projects
Unverified Commit f702aee6 authored by Sloan Sparger's avatar Sloan Sparger Committed by GitHub
Browse files

Sort trash collection by last_edited_at desc (#44181)

parent 8c416bd9
Branches
Tags
No related merge requests found
......@@ -34,6 +34,20 @@ import {
CollectionTable,
} from "./CollectionContent.styled";
const getDefaultSortingOptions = (
collection: Collection | undefined,
): SortingOptions => {
return isRootTrashCollection(collection)
? {
sort_column: "last_edited_at",
sort_direction: SortDirection.Desc,
}
: {
sort_column: "name",
sort_direction: SortDirection.Asc,
};
};
export type CollectionItemsTableProps = {
collectionId: CollectionId;
} & Partial<{
......@@ -81,10 +95,7 @@ export const CollectionItemsTable = ({
const isEmbeddingSdk = useSelector(getIsEmbeddingSdk);
const [unpinnedItemsSorting, setUnpinnedItemsSorting] =
useState<SortingOptions>({
sort_column: "name",
sort_direction: SortDirection.Asc,
});
useState<SortingOptions>(() => getDefaultSortingOptions(collection));
const [total, setTotal] = useState<number | null>(null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment