@bobfrankston/mailx-imap 0.1.87 → 0.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.
Files changed (2) hide show
  1. package/index.js +24 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2664,6 +2664,22 @@ export class ImapManager extends EventEmitter {
2664
2664
  clearTimeout(expungeTimer);
2665
2665
  expungeTimer = setTimeout(() => {
2666
2666
  expungeTimer = null;
2667
+ // Skip while WE have sync actions draining. Every
2668
+ // delete/move we push EXPUNGEs on the server and bounces
2669
+ // straight back here as an onExpunge — and a reconcile
2670
+ // of a large INBOX is a full server-vs-local set-diff.
2671
+ // During a bulk delete that meant one ~135k-row reconcile
2672
+ // per message (the 2s debounce can't coalesce them — our
2673
+ // moves arrive ~2.5s apart), hammering the DB so the list
2674
+ // sat on "Loading…" with a stale preview (Bob 2026-06-12).
2675
+ // The local store already reflects our own moves, so these
2676
+ // are redundant. The last move empties the queue, so its
2677
+ // trailing expunge runs exactly ONE reconcile to catch any
2678
+ // genuinely-external change.
2679
+ if (this.db.getPendingSyncActions(accountId).length > 0) {
2680
+ console.log(` [idle] ${accountId}: INBOX expunge during own drain — deferring reconcile`);
2681
+ return;
2682
+ }
2667
2683
  const inbox = this.db.getFolders(accountId).find(f => f.specialUse === "inbox");
2668
2684
  if (!inbox)
2669
2685
  return;
@@ -3416,7 +3432,14 @@ export class ImapManager extends EventEmitter {
3416
3432
  }
3417
3433
  try {
3418
3434
  if (action.action === "flags" && api.setFlags) {
3419
- await api.setFlags(folder.path, action.uid, action.flags || []);
3435
+ // Pass the stored Gmail message id (provider_id) for
3436
+ // the same reason as trashMessage below: without it
3437
+ // setFlags falls back to a capped list-and-hash
3438
+ // search that misses older messages, so starring one
3439
+ // failed ("UID not found in INBOX") and the local
3440
+ // star reverted on the next sync (Bob 2026-06-12).
3441
+ const env = this.db.getMessageByUid(accountId, action.uid);
3442
+ await api.setFlags(folder.path, action.uid, action.flags || [], env?.providerId);
3420
3443
  console.log(` [api] ${accountId}: flags synced UID ${action.uid}`);
3421
3444
  }
3422
3445
  else if ((action.action === "delete" || action.action === "trash") && api.trashMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",