Skip to content

feat: show unread counts#1343

Open
mavonx wants to merge 2 commits into
floatpane:masterfrom
mavonx:fix/issue-645
Open

feat: show unread counts#1343
mavonx wants to merge 2 commits into
floatpane:masterfrom
mavonx:fix/issue-645

Conversation

@mavonx
Copy link
Copy Markdown
Contributor

@mavonx mavonx commented May 22, 2026

What?

Shows unread email counts next to folder names in the sidebar.

Why?

Folder list showed folder names only, making it impossible to see which folders have unread mail without opening each one.
This improves navigation efficiency.

Closes #645

@mavonx mavonx requested a review from a team as a code owner May 22, 2026 08:52
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

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

Hi @mavonx! Please fix the following issues with your PR:

  • Title: Is too long (45 characters). The PR title must be strictly under 40 characters.

@floatpanebot floatpanebot added area/tui Terminal UI / view layer area/fetcher IMAP fetch / IDLE / search enhancement New feature or request performance Performance improvement size/M Diff: 51–200 lines labels May 22, 2026
@mavonx mavonx changed the title feat: show unread counts next to folder names feat: show unread counts May 22, 2026
@floatpanebot floatpanebot dismissed their stale review May 22, 2026 08:53

Formatting issues have been resolved. Thank you!

@mavonx
Copy link
Copy Markdown
Contributor Author

mavonx commented May 22, 2026

@andrinoff

I've implemented the unread counters feature for the IMAP backend for now.

I also wanted to note that when folder names are initially loaded from the cache, there will be a delay before the counters display correctly once the server fetch completes. To remove this delay, I thought about storing the unread counter alongside each folder in folder_cache.json, but this introduces a consistency problem — when a user reads an unread email, I update the counter in memory (already done), but I'd also need to write the updated counter back to the cache on every read action.

Let me know if you have a different approach to handle this.

@andrinoff
Copy link
Copy Markdown
Member

andrinoff commented May 22, 2026

i'd cache this and load it from folder_cache @mavonx, it doesn't have to be a re-fetch every time you open matcha. as far as implementation goes, just add it to handler of reading an email (e.g. it is marked read, no matter what the server receives, it is handled, when an email is opened) just subtract 1 from the correct folder, and leave it to re-fetch to make sure it is correct later.

@mavonx
Copy link
Copy Markdown
Contributor Author

mavonx commented May 22, 2026

@andrinoff

I already decrease the unread count from the selected folder in memory.

But just to make sure: if I load the counters from the cache and don't update the cached counters after each unread email is marked as read, then the counters will only stay correct while the user is in the same process/session, but if the user closes the current session and opens it again, they will see the outdated counter from the cache until the server fetch corrects it.

So, is that okay?

@andrinoff
Copy link
Copy Markdown
Member

you should update the cache when an email is read (opened). when matcha is re-fetching it should also update the counter

@floatpanebot floatpanebot added the area/config Configuration / settings label May 22, 2026
@mavonx
Copy link
Copy Markdown
Contributor Author

mavonx commented May 22, 2026

@andrinoff I'll check the tests tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Configuration / settings area/fetcher IMAP fetch / IDLE / search area/tui Terminal UI / view layer enhancement New feature or request performance Performance improvement size/M Diff: 51–200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: Add unread count to folder list

3 participants