Skip to content

Conversation

BijinDev
Copy link
Contributor

QuickSearch now shows the most recent mails rather than the first 10 mails from the "From date"

close #9342

@BijinDev BijinDev linked an issue Jul 21, 2025 that may be closed by this pull request
2 tasks
@charlag
Copy link
Contributor

charlag commented Jul 21, 2025

Doesn't this also affect IndexedDB search?
I think it would be better to fix it where we actually do SQLite query

@BijinDev BijinDev force-pushed the 9342-quicksearch-mails branch from c007db8 to ca9f846 Compare July 23, 2025 10:48
@BijinDev
Copy link
Contributor Author

Doesn't this also affect IndexedDB search?
I think it would be better to fix it where we actually do SQLite query

we are ordering by recievedDate in SQLite query, but loading entities changes the order. so now we are sorting the array before showing in Overlay. Same like we are doing in searchView

@hrb-hub hrb-hub force-pushed the 9342-quicksearch-mails branch from ca9f846 to c037d15 Compare July 23, 2025 13:49
Copy link
Contributor

@charlag charlag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, sorry that I pointed you in the wrong direction earlier!

@hrb-hub hrb-hub force-pushed the 9342-quicksearch-mails branch from c037d15 to c60570b Compare July 30, 2025 09:24
@hrb-hub hrb-hub force-pushed the 9342-quicksearch-mails branch from c60570b to cf443c6 Compare July 31, 2025 07:01
Even though the results we get from offline mail_index are sorted in
descending order, loading entities changes the order to:
- Newest Mailbag -> Oldest Mailbag
- And within each mailbag: Oldest Mail -> Newest Mail

Example:
- Ordered result from offline index: [[1,b],[1,a],[0,b],[0,a]]
- After loading entities: [[1,a],[1,b],[0,a],[0,b]]

This happens because we loadMultiple mails grouped by listId.
So we make sure to sort by receivedDate after loading entities.

Close #9342

Co-authored-by: hrb-hub <hrb-hub@users.noreply.github.com>
@BijinDev BijinDev force-pushed the 9342-quicksearch-mails branch from cf443c6 to 9abb9cc Compare August 4, 2025 10:02
@BijinDev BijinDev merged commit 9abb9cc into dev-mail Aug 4, 2025
6 checks passed
@BijinDev BijinDev deleted the 9342-quicksearch-mails branch August 4, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quick search displays mails in descending order
2 participants