Skip to content

Commit 717c28f

Browse files
authored
Merge pull request #1619 from mercihabam/fix-request-latency
fix(frontend): improve performance when visiting a message from the list view
2 parents a013135 + 58664aa commit 717c28f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

modules/core/site.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ function Message_List() {
11191119
while (target[0].tagName != 'TR') { target = target.parent(); }
11201120
var el = $('input[type=checkbox]', target);
11211121
if (!shift && !ctrl) {
1122-
navigate($('.subject a', target).prop('href'));
11231122
return false;
11241123
}
11251124
else {

modules/imap/js_modules/route_handlers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,22 @@ function applyImapMessageContentPageHandlers(routeParams) {
2323
window.dispatchEvent(new CustomEvent('message-loaded'));
2424
});
2525

26-
const messages = new Hm_MessagesStore(routeParams.list_path, routeParams.list_page, `${routeParams.keyword}_${routeParams.filter}`, getParam('sort'));
26+
const listPath = routeParams.list_parent || routeParams.list_path;
27+
const messages = new Hm_MessagesStore(listPath, routeParams.list_page, `${routeParams.keyword}_${routeParams.filter}`, getParam('sort'));
2728
messages.load(false);
2829
const next = messages.getNextRowForMessage(routeParams.uid);
2930
const prev = messages.getPreviousRowForMessage(routeParams.uid);
3031
if (next) {
32+
const nextHref = $(next['0']).find(".subject a").prop('href');
33+
const nextListPath = new URLSearchParams(nextHref.split('?')[1]).get('list_path');
3134
const nextMessageUid = $(next['0']).data('uid');
32-
preFetchMessageContent(false, nextMessageUid, routeParams.list_path);
35+
preFetchMessageContent(false, nextMessageUid, nextListPath);
3336
}
3437
if (prev) {
38+
const prevHref = $(prev['0']).find(".subject a").prop('href');
39+
const prevListPath = new URLSearchParams(prevHref.split('?')[1]).get('list_path');
3540
const prevMessageUid = $(prev['0']).data('uid');
36-
preFetchMessageContent(false, prevMessageUid, routeParams.list_path);
41+
preFetchMessageContent(false, prevMessageUid, prevListPath);
3742
}
3843

3944
if (window.pgpMessageContentPageHandler) pgpMessageContentPageHandler();

0 commit comments

Comments
 (0)