File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
apps/desktop/layer/renderer/src/store/entry Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,20 @@ import { useSubscriptionStore } from "../subscription"
7
7
import { useEntryStore } from "./store"
8
8
import type { EntryFilter } from "./types"
9
9
10
+ export const getSortedEntryIds = ( entriesIds : string [ ] ) => {
11
+ const state = useEntryStore . getState ( )
12
+ const idsSorted = entriesIds . sort ( ( a , b ) => {
13
+ const entryA = state . flatMapEntries [ a ]
14
+ const entryB = state . flatMapEntries [ b ]
15
+ if ( ! entryA || ! entryB ) return 0
16
+ return (
17
+ new Date ( entryB . entries . publishedAt ) . getTime ( ) -
18
+ new Date ( entryA . entries . publishedAt ) . getTime ( )
19
+ )
20
+ } )
21
+ return idsSorted
22
+ }
23
+
10
24
export const getFilteredFeedIds = ( feedIds : string [ ] , filter ?: EntryFilter ) => {
11
25
const state = useEntryStore . getState ( )
12
26
const ids = [ ] as string [ ]
@@ -24,9 +38,9 @@ export const getFilteredFeedIds = (feedIds: string[], filter?: EntryFilter) => {
24
38
result . push ( entryId )
25
39
}
26
40
}
27
- return result
41
+ return getSortedEntryIds ( result )
28
42
}
29
- return ids
43
+ return getSortedEntryIds ( ids )
30
44
}
31
45
32
46
const unread = create ( {
You can’t perform that action at this time.
0 commit comments