mobile: sort attachment manager by recently uploaded

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2026-08-13 13:07:04 +05:00
parent 07a3687afd
commit df9cb7c3ff

View File

@@ -52,7 +52,7 @@ import Paragraph from "../ui/typography/paragraph";
import { AttachmentItem } from "./attachment-item";
const DEFAULT_SORTING: SortOptions = {
sortBy: "dateEdited",
sortBy: "dateUploaded",
sortDirection: "desc"
};
@@ -154,21 +154,13 @@ export const AttachmentDialog = ({
if (note) {
db.attachments
.ofNote(note.id, "all")
.sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
})
.sorted(DEFAULT_SORTING)
.then((attachments) => {
setLoading(false);
setAttachments(attachments);
});
} else {
db.attachments.all
.sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
})
.then((attachments) => {
db.attachments.all.sorted(DEFAULT_SORTING).then((attachments) => {
setAttachments(attachments);
setLoading(false);
});
@@ -306,10 +298,7 @@ export const AttachmentDialog = ({
: db.attachments.all;
}
return await items.sorted({
...DEFAULT_SORTING,
sortBy: "dateModified"
});
return await items.sorted(DEFAULT_SORTING);
};
db.attachments.orphaned.items().then((r) => {