fix: Old Reolink media items shown instead of more recent ones (#2081)
- Closes: #2078
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { orderBy } from 'lodash-es';
|
||||
import { BrowseMediaMetadata, RichBrowseMedia } from './types';
|
||||
|
||||
// Unlike sorting of view items (see card-controller/view/sort.ts), for browse
|
||||
// media we often need to sort by most recent first to apply an item count
|
||||
// cutoff from the most recent (this differs from how items may be sorted prior
|
||||
// to presentation).
|
||||
//
|
||||
// See: https://github.com/dermotduffy/advanced-camera-card/issues/2078
|
||||
|
||||
export const sortMostRecentFirst = (
|
||||
media: RichBrowseMedia<BrowseMediaMetadata>[],
|
||||
): RichBrowseMedia<BrowseMediaMetadata>[] => {
|
||||
return orderBy(media, (media) => media._metadata?.startDate, 'desc');
|
||||
};
|
||||
Reference in New Issue
Block a user