Skip to content

🎧 Your Personal Streaming Service

Change default sort for albums view to alphabetically (list) or most recent (grid)

Deluan3a54246b15fa
diff --git a/ui/src/album/AlbumList.js b/ui/src/album/AlbumList.js
index ace8a9680..6a6947a0d 100644
--- a/ui/src/album/AlbumList.js
+++ b/ui/src/album/AlbumList.js
@@ -53,7 +53,12 @@ const getPerPageOptions = (width) => {
const AlbumList = (props) => {
const { width } = props
const albumView = useSelector((state) => state.albumView)
-
+ let sort
+ if (albumView.mode === ALBUM_MODE_LIST) {
+ sort = { field: 'name', order: 'ASC' }
+ } else {
+ sort = { field: 'created_at', order: 'DESC' }
+ }
return (
<List
{...props}
@@ -61,6 +66,7 @@ const AlbumList = (props) => {
exporter={false}
bulkActionButtons={false}
actions={<AlbumListActions />}
+ sort={sort}
filters={<AlbumFilter />}
perPage={getPerPage(width)}
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}