Repository navigation
fix(tui): update folder unread counter - #1493
Merged
Merged
Conversation
The delete/archive handlers mutated the email stores but never touched the per-folder unread map, so the sidebar folder counter stayed stale until the next server fetch. Decrement it for each removed unread email (mirroring the read/unread path) and re-increment on undo. Closes floatpane#1404
andrinoff
enabled auto-merge
June 20, 2026 19:24
andrinoff
approved these changes
Jun 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 20, 2026
floatpanebot
pushed a commit
that referenced
this pull request
Jun 20, 2026
## What? After deleting or archiving emails, the per-folder unread counter shown in the sidebar (`(N)`) now updates immediately. The four handlers (`DeleteEmailMsg`, `ArchiveEmailMsg`, `BatchDeleteEmailsMsg`, `BatchArchiveEmailsMsg`) decrement `m.unread[folder]` for each removed unread email via a new `decrementFolderUnreadForRemoved` helper that mirrors the existing read/unread path (`DecrementUnreadCount` + persist); undo re-increments it. Adds five tests. ## Why? The delete/archive handlers mutated the email stores but never touched `m.unread`, so the sidebar folder counter stayed stale until the next server fetch (#1404). (`syncUnreadBadge` only sets the macOS dock badge, so it did not address this.) Closes #1404 (cherry picked from commit d093013)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
After deleting or archiving emails, the per-folder unread counter shown in the sidebar (
(N)) now updates immediately. The four handlers (DeleteEmailMsg,ArchiveEmailMsg,BatchDeleteEmailsMsg,BatchArchiveEmailsMsg) decrementm.unread[folder]for each removed unread email via a newdecrementFolderUnreadForRemovedhelper that mirrors the existing read/unread path (DecrementUnreadCount+ persist); undo re-increments it. Adds five tests.Why?
The delete/archive handlers mutated the email stores but never touched
m.unread, so the sidebar folder counter stayed stale until the next server fetch (#1404). (syncUnreadBadgeonly sets the macOS dock badge, so it did not address this.)Closes #1404