Don't reset the message list to page 1 and clear the search on message.show

The `mailbox.message.show` handler rewrote the hash to `mailBox(sFolder)` --
page 1, no search -- even when the user was already in that folder.

Because the hash of an open message carries the message id and the new one does
not, the two differ, the route fires again, the message is shown again, and the
handler runs again: a loop. Every iteration aborts whatever message list request
was pending, so browsing to page 2 or running a search silently bounces back to
page 1 of the INBOX with an empty search box.

Only navigate when we are not already in that folder. Clicking a new-mail
notification from another folder still takes you to the INBOX; if the message is
not in the current page, the else branch already opens it in the preview pane
without touching the list.

The same unconditional setHash a few lines below, for non-INBOX folders, gets
the same guard.
This commit is contained in:
SebaSalvaG 2026-08-23 22:38:40 +02:00
parent c154d23cfe
commit e4ecda0e61

View file

@ -303,14 +303,14 @@ export class MailMessageList extends AbstractViewRight {
item => sFolder === item?.folder && iUid == item?.uid item => sFolder === item?.folder && iUid == item?.uid
); );
if ('INBOX' === sFolder) { if ('INBOX' === sFolder && 'INBOX' !== FolderUserStore.currentFolderFullName()) {
hasher.setHash(mailBox(sFolder)); hasher.setHash(mailBox(sFolder));
} }
if (message) { if (message) {
this.selector.selectMessageItem(message); this.selector.selectMessageItem(message);
} else { } else {
if ('INBOX' !== sFolder) { if ('INBOX' !== sFolder && sFolder !== FolderUserStore.currentFolderFullName()) {
hasher.setHash(mailBox(sFolder)); hasher.setHash(mailBox(sFolder));
} }
if (sFolder && iUid) { if (sFolder && iUid) {