@bobfrankston/rmfmail 1.1.191 → 1.1.193

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.ts CHANGED
@@ -436,6 +436,15 @@ initFolderTree(folderTree, (accountId, folderId, folderName, specialUse) => {
436
436
  markAsSeen();
437
437
  releaseFocus();
438
438
  loadMessages(accountId, folderId, 1, specialUse);
439
+ // Lazy-folder-sync: opening a folder fetches its latest from the server
440
+ // (fire-and-forget). The full all-folders sweep now runs only every 30
441
+ // min, so on-open sync is what keeps a folder you're actually looking at
442
+ // fresh. The folderSynced event refreshes the list when it lands. INBOX
443
+ // is excluded — IDLE + the 5-min quick check already keep it live, and
444
+ // re-syncing it on every visit is wasted work.
445
+ if (specialUse !== "inbox") {
446
+ import("./lib/api-client.js").then(m => m.syncFolderNow?.(accountId, folderId)).catch(() => { /* */ });
447
+ }
439
448
  setTitle(`${APP_NAME} - ${folderName}`);
440
449
  setNarrowFolderTitle(folderName);
441
450
  // Record the navigation in the active tab so a later tab-switch restores
@@ -1091,6 +1091,7 @@ __export(api_client_exports, {
1091
1091
  showReminderPopup: () => showReminderPopup,
1092
1092
  subscribeStore: () => subscribeStore,
1093
1093
  syncAccount: () => syncAccount,
1094
+ syncFolderNow: () => syncFolderNow,
1094
1095
  triggerSync: () => triggerSync,
1095
1096
  undeleteMessage: () => undeleteMessage,
1096
1097
  unsubscribeOneClick: () => unsubscribeOneClick,
@@ -1204,6 +1205,9 @@ function triggerSync() {
1204
1205
  function syncAccount(accountId) {
1205
1206
  return ipc().syncAccount(accountId);
1206
1207
  }
1208
+ function syncFolderNow(accountId, folderId) {
1209
+ return ipc().syncFolderNow?.(accountId, folderId);
1210
+ }
1207
1211
  function reauthenticate(accountId) {
1208
1212
  return ipc().reauthenticate(accountId);
1209
1213
  }
@@ -1400,13 +1404,14 @@ function installConsoleCapture() {
1400
1404
  }
1401
1405
  };
1402
1406
  console.log = (...args) => {
1403
- forward("log", args);
1404
1407
  orig.log(...args);
1405
1408
  };
1406
1409
  console.info = (...args) => {
1407
- forward("info", args);
1408
1410
  orig.info(...args);
1409
1411
  };
1412
+ console.debug = (...args) => {
1413
+ orig.debug(...args);
1414
+ };
1410
1415
  console.warn = (...args) => {
1411
1416
  forward("warn", args);
1412
1417
  orig.warn(...args);
@@ -1415,10 +1420,6 @@ function installConsoleCapture() {
1415
1420
  forward("error", args);
1416
1421
  orig.error(...args);
1417
1422
  };
1418
- console.debug = (...args) => {
1419
- forward("debug", args);
1420
- orig.debug(...args);
1421
- };
1422
1423
  try {
1423
1424
  window.addEventListener("error", (e) => {
1424
1425
  try {
@@ -1435,8 +1436,11 @@ function installConsoleCapture() {
1435
1436
  window.addEventListener("unhandledrejection", (e) => {
1436
1437
  try {
1437
1438
  const r = e.reason;
1439
+ const msg = r?.message || String(r);
1440
+ if (/logClientEvent|mailxapi timeout/i.test(msg))
1441
+ return;
1438
1442
  logClientEvent("window.unhandledrejection", {
1439
- message: r?.message || String(r),
1443
+ message: msg,
1440
1444
  stack: r?.stack || null
1441
1445
  });
1442
1446
  } catch {
@@ -1450,7 +1454,10 @@ function logClientEvent(tag, data) {
1450
1454
  try {
1451
1455
  const bridge = typeof globalThis.mailxapi !== "undefined" && globalThis.mailxapi?.isApp ? globalThis.mailxapi : window.opener?.mailxapi?.isApp ? window.opener.mailxapi : window.parent?.mailxapi?.isApp ? window.parent.mailxapi : null;
1452
1456
  if (bridge?.logClientEvent) {
1453
- bridge.logClientEvent(tag, data);
1457
+ const p = bridge.logClientEvent(tag, data);
1458
+ if (p && typeof p.catch === "function")
1459
+ p.catch(() => {
1460
+ });
1454
1461
  delivered = true;
1455
1462
  }
1456
1463
  } catch {