@bobfrankston/rmfmail 1.1.245 → 1.1.247

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.
@@ -2379,18 +2379,20 @@ export class MailxService implements MailxApi {
2379
2379
  try {
2380
2380
  await client.createmailbox(fullPath);
2381
2381
  // Local-first: insert the new folder into the DB immediately so
2382
- // the UI shows it on the next tree refresh — no waiting for a
2383
- // round-trip LIST in syncFolders. The next syncFolders pass will
2384
- // re-upsert with canonical special-use / delimiter (no-op here,
2385
- // since CREATE folders never carry special-use flags).
2382
+ // the UI shows it on the next tree refresh.
2386
2383
  this.db.upsertFolder(accountId, fullPath, name, null, delimiter);
2387
2384
  this.imapManager.emit("folderCountsChanged", accountId, {});
2388
- // Best-effort full resync verifies the server accepted CREATE
2389
- // and picks up anything else changed since the last pass. Async
2390
- // so the IPC returns quickly; the optimistic row is already in
2391
- // place if this lags.
2392
- this.imapManager.syncFolders(accountId, client).catch((e: any) =>
2393
- console.error(` [createFolder] post-create syncFolders failed: ${e?.message || e}`));
2385
+ // VERIFY the server actually created it, and AWAIT it. createmailbox
2386
+ // on a wedged/congested connection has returned without error while
2387
+ // the CREATE never reached the server so the IPC reported success,
2388
+ // the optimistic row got dropped by the next reconcile, and the
2389
+ // folder silently never appeared (Bob 2026-06-12, Archive/dbgtrash).
2390
+ // A folder create is infrequent; correctness beats the fast return.
2391
+ await this.imapManager.syncFolders(accountId, client);
2392
+ const created = this.db.getFolders(accountId).some(f => f.path === fullPath);
2393
+ if (!created) {
2394
+ throw new Error(`Folder "${name}" was not created on the server — please try again (the connection may have been busy).`);
2395
+ }
2394
2396
  } finally { try { await client.logout(); } catch { /* */ } }
2395
2397
  }
2396
2398