mobile: fix sorting attachments

This commit is contained in:
Ammar Ahmed
2024-03-04 12:06:01 +05:00
committed by Abdullah Atta
parent 35c8848b89
commit 19f4fbfcf7

View File

@@ -61,10 +61,16 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
const refresh = React.useCallback(() => {
if (note) {
db.attachments.ofNote(note.id, "all").sorted(DEFAULT_SORTING);
db.attachments.ofNote(note.id, "all").sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
});
} else {
db.attachments.all
.sorted(DEFAULT_SORTING)
.sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
})
.then((attachments) => setAttachments(attachments));
}
}, [note]);
@@ -170,7 +176,10 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
: db.attachments.documents;
}
return await items.sorted(DEFAULT_SORTING);
return await items.sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
});
};
return (