fix: sort everything by dateCreated descending

This commit is contained in:
thecodrr
2021-02-27 11:55:13 +05:00
parent bb41b8c9cb
commit 8eb590f9d2
5 changed files with 17 additions and 17 deletions

View File

@@ -1,4 +1,6 @@
import { qclone } from "qclone";
import sort from "fast-sort";
export default class Topic {
/**
* @param {Object} topic
@@ -83,11 +85,11 @@ export default class Topic {
}
get all() {
return this._topic.notes
.map((note) => {
let fullNote = this._db.notes.note(note);
if (fullNote) return fullNote.data;
})
.filter((v) => v);
const notes = this._topic.notes.reduce((arr, noteId) => {
let note = this._db.notes.note(noteId);
if (note) arr.push(note.data);
return arr;
}, []);
return sort(notes).desc((note) => note.dateCreated);
}
}