@bobfrankston/rmfmail 1.2.34 → 1.2.36

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
@@ -2486,6 +2486,7 @@ function doSearch(immediate = false) {
2486
2486
  let currentAccountId = "";
2487
2487
  let currentFolderId = 0;
2488
2488
  let reloadDebounceTimer = null;
2489
+ let lastListReloadAt = 0;
2489
2490
  searchInput?.addEventListener("input", () => {
2490
2491
  clearTimeout(searchTimeout);
2491
2492
  if (serverSearchTimer) {
@@ -3048,13 +3049,26 @@ onWsEvent((event) => {
3048
3049
  // accounts where STATUS polls fire frequently.
3049
3050
  updateFolderCounts();
3050
3051
  updateNewMessageCount();
3051
- // Debounced silent reload preserves scroll position, selection, and viewer
3052
+ // LEADING-EDGE + trailing debounce. The old pure-trailing 2 s debounce
3053
+ // meant new INBOX mail didn't appear in the list for 2 s after sync
3054
+ // said "done" (Bob 2026-06-18: "long delay before I see the new
3055
+ // messages ... I should see new inbox entries immediately"). The reload
3056
+ // is SILENT (preserves scroll/selection/viewer), so reloading on the
3057
+ // leading edge is non-disruptive: show new mail NOW if it's been >1.5 s
3058
+ // since the last reload, then a trailing reload coalesces the rest of a
3059
+ // sync burst into one final settle.
3060
+ const nowMs = Date.now();
3061
+ if (nowMs - lastListReloadAt > 1500) {
3062
+ lastListReloadAt = nowMs;
3063
+ reloadCurrentFolder();
3064
+ }
3052
3065
  if (reloadDebounceTimer)
3053
3066
  clearTimeout(reloadDebounceTimer);
3054
3067
  reloadDebounceTimer = setTimeout(() => {
3055
3068
  reloadDebounceTimer = null;
3069
+ lastListReloadAt = Date.now();
3056
3070
  reloadCurrentFolder();
3057
- }, 2000);
3071
+ }, 1500);
3058
3072
  // Sync succeeded — clear any transient error banner and re-enable sync button
3059
3073
  hideAlert();
3060
3074
  const syncBtn = document.getElementById("btn-sync");