@bobfrankston/mailx 1.0.407 → 1.0.409

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Wires together all UI components and WebSocket connection.
4
4
  */
5
5
  import { initFolderTree, refreshFolderTree, updateFolderCounts, setFolderSynced, getFolderSynced, setOutboxTotal } from "./components/folder-tree.js";
6
- import { initMessageList, loadMessages, loadUnifiedInbox, loadSearchResults, reloadCurrentFolder, getSelectedMessages, markBodiesCached } from "./components/message-list.js";
6
+ import { initMessageList, loadMessages, loadUnifiedInbox, loadSearchResults, reloadCurrentFolder, clearSearchMode, getSelectedMessages, markBodiesCached } from "./components/message-list.js";
7
7
  import { showMessage, getCurrentMessage, initViewer } from "./components/message-viewer.js";
8
8
  import { connectWebSocket, onWsEvent, triggerSync, syncAccount, reauthenticate, getAccounts, getFolders, deleteMessages, undeleteMessage, restartServer, getSyncPending, getVersion, getSettings, saveSettings, getAutocompleteSettings, saveAutocompleteSettings, repairAccounts, updateFlags, markAsSpamMessages, logClientEvent, sendMessage as apiSendMessage } from "./lib/api-client.js";
9
9
  import * as messageState from "./lib/message-state.js";
@@ -1184,11 +1184,15 @@ let reloadDebounceTimer = null;
1184
1184
  searchInput?.addEventListener("input", () => {
1185
1185
  clearTimeout(searchTimeout);
1186
1186
  if (searchInput.value.trim() === "") {
1187
- // Cleared — reset immediately, no debounce
1187
+ // Cleared — reset immediately, no debounce. Must exit search mode
1188
+ // first; otherwise reloadCurrentFolder() sees searchMode=true and
1189
+ // re-runs the stale query (user-reported regression 2026-04-24).
1190
+ clearSearchMode();
1188
1191
  const body = document.getElementById("ml-body");
1189
1192
  if (body)
1190
1193
  body.querySelectorAll(".filter-hidden").forEach(r => r.classList.remove("filter-hidden"));
1191
1194
  reloadCurrentFolder();
1195
+ setTitle("mailx");
1192
1196
  }
1193
1197
  else {
1194
1198
  searchTimeout = setTimeout(() => doSearch(false), 300);
@@ -1201,11 +1205,13 @@ searchInput?.addEventListener("keydown", (e) => {
1201
1205
  }
1202
1206
  if (e.key === "Escape") {
1203
1207
  searchInput.value = "";
1208
+ clearSearchMode();
1204
1209
  // Clear any client-side filters
1205
1210
  const body = document.getElementById("ml-body");
1206
1211
  if (body)
1207
1212
  body.querySelectorAll(".filter-hidden").forEach(r => r.classList.remove("filter-hidden"));
1208
1213
  reloadCurrentFolder();
1214
+ setTitle("mailx");
1209
1215
  }
1210
1216
  });
1211
1217
  // Message state handles move/delete — no manual event listener needed
@@ -9,6 +9,7 @@ import { pickFolder } from "./folder-picker.js";
9
9
  let onMessageSelect;
10
10
  let currentAccountId;
11
11
  let currentFolderId;
12
+ let currentSpecialUse = ""; // Cached for reloads — an empty value on reload used to reset Sent/Drafts/Outbox to "From"
12
13
  let lastClickedRow = null;
13
14
  let currentPage;
14
15
  let totalMessages;
@@ -329,10 +330,18 @@ export function reloadCurrentFolder() {
329
330
  loadMessages(currentAccountId, currentFolderId, 1, "", false);
330
331
  }
331
332
  }
333
+ /** Exit search mode without triggering a reload — caller decides what to load
334
+ * next. Used by the search-input "cleared to empty" handler so the next
335
+ * reloadCurrentFolder() call doesn't re-run the stale search query. */
336
+ export function clearSearchMode() {
337
+ searchMode = false;
338
+ currentSearchQuery = "";
339
+ }
332
340
  /** Load unified inbox (all accounts) */
333
341
  export async function loadUnifiedInbox(autoSelect = true) {
334
342
  unifiedMode = true;
335
343
  searchMode = false;
344
+ currentSpecialUse = "";
336
345
  showToInsteadOfFrom = false; // Unified inbox always shows From, not To
337
346
  currentPage = 1;
338
347
  totalMessages = 0;
@@ -439,7 +448,12 @@ export async function loadMessages(accountId, folderId, page = 1, specialUse = "
439
448
  // specialUse is either the DB tag ("sent"/"drafts"/"outbox") or the
440
449
  // folder path lowercased (folder-tree fallback when tag is missing — common
441
450
  // on Dovecot which doesn't advertise \Sent). Match both cases.
442
- const su = (specialUse || "").toLowerCase();
451
+ // Empty specialUse on reload means "keep what we had" — otherwise a
452
+ // folderCountsChanged event or sort-header click resets Sent/Drafts/Outbox
453
+ // back to showing From (user-reported regression 2026-04-24).
454
+ if (specialUse)
455
+ currentSpecialUse = specialUse;
456
+ const su = currentSpecialUse.toLowerCase();
443
457
  showToInsteadOfFrom = su === "sent" || su === "drafts" || su === "outbox"
444
458
  || su.endsWith("sent") || su.endsWith("drafts") || su.endsWith("outbox")
445
459
  || su === "sent items" || su === "sent mail" || su.endsWith("/sent items") || su.endsWith(".sent items");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.407",
3
+ "version": "1.0.409",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -31,12 +31,12 @@
31
31
  "postinstall": "node bin/postinstall.js"
32
32
  },
33
33
  "dependencies": {
34
- "@bobfrankston/iflow-direct": "^0.1.26",
35
- "@bobfrankston/iflow-node": "^0.1.7",
36
- "@bobfrankston/miscinfo": "^1.0.9",
37
- "@bobfrankston/oauthsupport": "^1.0.24",
38
- "@bobfrankston/msger": "^0.1.349",
39
- "@bobfrankston/mailx-host": "^0.1.4",
34
+ "@bobfrankston/iflow-direct": "^0.1.27",
35
+ "@bobfrankston/iflow-node": "^0.1.8",
36
+ "@bobfrankston/miscinfo": "^1.0.10",
37
+ "@bobfrankston/oauthsupport": "^1.0.25",
38
+ "@bobfrankston/msger": "^0.1.350",
39
+ "@bobfrankston/mailx-host": "^0.1.5",
40
40
  "@capacitor/android": "^8.3.0",
41
41
  "@capacitor/cli": "^8.3.0",
42
42
  "@capacitor/core": "^8.3.0",
@@ -47,10 +47,10 @@
47
47
  "quill": "^2.0.3",
48
48
  "ws": "^8.18.0",
49
49
  "sql.js": "^1.14.1",
50
- "@bobfrankston/tcp-transport": "^0.1.4",
51
- "@bobfrankston/node-tcp-transport": "^0.1.4",
52
- "@bobfrankston/smtp-direct": "^0.1.4",
53
- "@bobfrankston/mailx-sync": "^0.1.9"
50
+ "@bobfrankston/tcp-transport": "^0.1.5",
51
+ "@bobfrankston/node-tcp-transport": "^0.1.6",
52
+ "@bobfrankston/smtp-direct": "^0.1.5",
53
+ "@bobfrankston/mailx-sync": "^0.1.10"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/mailparser": "^3.4.6"
@@ -95,12 +95,12 @@
95
95
  },
96
96
  ".transformedSnapshot": {
97
97
  "dependencies": {
98
- "@bobfrankston/iflow-direct": "^0.1.26",
99
- "@bobfrankston/iflow-node": "^0.1.7",
100
- "@bobfrankston/miscinfo": "^1.0.9",
101
- "@bobfrankston/oauthsupport": "^1.0.24",
102
- "@bobfrankston/msger": "^0.1.349",
103
- "@bobfrankston/mailx-host": "^0.1.4",
98
+ "@bobfrankston/iflow-direct": "^0.1.27",
99
+ "@bobfrankston/iflow-node": "^0.1.8",
100
+ "@bobfrankston/miscinfo": "^1.0.10",
101
+ "@bobfrankston/oauthsupport": "^1.0.25",
102
+ "@bobfrankston/msger": "^0.1.350",
103
+ "@bobfrankston/mailx-host": "^0.1.5",
104
104
  "@capacitor/android": "^8.3.0",
105
105
  "@capacitor/cli": "^8.3.0",
106
106
  "@capacitor/core": "^8.3.0",
@@ -111,10 +111,10 @@
111
111
  "quill": "^2.0.3",
112
112
  "ws": "^8.18.0",
113
113
  "sql.js": "^1.14.1",
114
- "@bobfrankston/tcp-transport": "^0.1.4",
115
- "@bobfrankston/node-tcp-transport": "^0.1.4",
116
- "@bobfrankston/smtp-direct": "^0.1.4",
117
- "@bobfrankston/mailx-sync": "^0.1.9"
114
+ "@bobfrankston/tcp-transport": "^0.1.5",
115
+ "@bobfrankston/node-tcp-transport": "^0.1.6",
116
+ "@bobfrankston/smtp-direct": "^0.1.5",
117
+ "@bobfrankston/mailx-sync": "^0.1.10"
118
118
  }
119
119
  }
120
120
  }