@bobfrankston/rmfmail 1.1.87 → 1.1.89

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
@@ -1921,8 +1921,11 @@ function recordSearchHistory(query) {
1921
1921
  if (!trimmed)
1922
1922
  return;
1923
1923
  const cur = loadSearchHistory();
1924
- // Move-to-front dedup: if already there, pull it; then prepend.
1925
- const filtered = cur.filter(q => q !== trimmed);
1924
+ // Move-to-front dedup, AND drop any entry that is a prefix of this
1925
+ // query that collapses the in-progress typing ("Hod", "Hodd") into
1926
+ // the final "Hoddie", so a live search the user never pressed Enter on
1927
+ // still lands in history exactly once.
1928
+ const filtered = cur.filter(q => q !== trimmed && !trimmed.startsWith(q));
1926
1929
  filtered.unshift(trimmed);
1927
1930
  if (filtered.length > SEARCH_HISTORY_MAX)
1928
1931
  filtered.length = SEARCH_HISTORY_MAX;
@@ -2039,10 +2042,11 @@ function doSearch(immediate = false) {
2039
2042
  loadSearchResults(query, effectiveScope, currentAccountId, currentFolderId, includeTrash);
2040
2043
  setTitle(`${APP_NAME} - Search: ${query}`);
2041
2044
  setActiveTabView({ kind: "search", query, scope: effectiveScope, accountId: currentAccountId, folderId: currentFolderId, includeTrash }, `Search: ${query}`);
2042
- // Only record on `immediate=true` (Enter / scope change) debounced
2043
- // typing would otherwise add every keystroke as its own entry.
2044
- if (immediate)
2045
- recordSearchHistory(query);
2045
+ // Record every executed search Enter AND a settled debounced search
2046
+ // alike. The prefix-pruning in recordSearchHistory() collapses the
2047
+ // keystroke progression, so a search the user typed without pressing
2048
+ // Enter ("Hoddie") still shows up in history.
2049
+ recordSearchHistory(query);
2046
2050
  }
2047
2051
  // Track current folder for scoped search
2048
2052
  let currentAccountId = "";