From 19f4fbfcf7db8a992b3ac8be4d169325ec47ae6c Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 4 Mar 2024 12:06:01 +0500 Subject: [PATCH] mobile: fix sorting attachments --- apps/mobile/app/components/attachments/index.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/mobile/app/components/attachments/index.tsx b/apps/mobile/app/components/attachments/index.tsx index 9563f8b58..f5e9cebbb 100644 --- a/apps/mobile/app/components/attachments/index.tsx +++ b/apps/mobile/app/components/attachments/index.tsx @@ -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 (