mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-16 23:31:19 +03:00
Sort first
This commit is contained in:
parent
1638bb4e37
commit
96f61e6e3f
1 changed files with 7 additions and 7 deletions
|
@ -25,6 +25,13 @@ function Following({ title, path, id, headerStart }) {
|
|||
const results = await homeIterator.current.next();
|
||||
const { value } = results;
|
||||
if (value?.length) {
|
||||
// ENFORCE sort by datetime (Latest first)
|
||||
value.sort((a, b) => {
|
||||
const aDate = new Date(a.createdAt);
|
||||
const bDate = new Date(b.createdAt);
|
||||
return bDate - aDate;
|
||||
});
|
||||
|
||||
if (firstLoad) {
|
||||
latestItem.current = value[0].id;
|
||||
}
|
||||
|
@ -32,13 +39,6 @@ function Following({ title, path, id, headerStart }) {
|
|||
value.forEach((item) => {
|
||||
saveStatus(item, instance);
|
||||
});
|
||||
|
||||
// ENFORCE sort by datetime (Latest first)
|
||||
value.sort((a, b) => {
|
||||
const aDate = new Date(a.createdAt);
|
||||
const bDate = new Date(b.createdAt);
|
||||
return bDate - aDate;
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue