@bobfrankston/rmfmail 1.2.183 → 1.2.185

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.
@@ -1599,6 +1599,19 @@ function clearViewer() {
1599
1599
  headerEl.hidden = true;
1600
1600
  if (attEl)
1601
1601
  attEl.hidden = true;
1602
+ setTimeout(() => {
1603
+ try {
1604
+ const stillPlaceholder = !!document.querySelector("#mv-body .mv-empty");
1605
+ if (!stillPlaceholder)
1606
+ return;
1607
+ const sel = document.querySelectorAll(".ml-row.selected");
1608
+ if (sel.length === 0)
1609
+ return;
1610
+ const uids = Array.from(sel).slice(0, 5).map((r) => `${r.dataset.accountId}/${r.dataset.uid}`);
1611
+ window.mailxapi?.logClientEvent?.("[fate-share] viewer empty but rows still highlighted", { rows: uids });
1612
+ } catch {
1613
+ }
1614
+ }, 1e3);
1602
1615
  }
1603
1616
  function confirmDeleteAttachments(msg, accountId, uid, ids, question) {
1604
1617
  const backdrop = document.createElement("div");
@@ -3113,8 +3126,23 @@ var init_message_viewer = __esm({
3113
3126
  return;
3114
3127
  if (!currentMessage)
3115
3128
  return;
3129
+ const evUuid = ev.msgUuid || ev.uuid;
3130
+ if (evUuid && currentMessage.uuid) {
3131
+ if (ev.accountId === currentAccountId && evUuid === currentMessage.uuid) {
3132
+ try {
3133
+ window.mailxapi?.logClientEvent?.("[fate-share] viewed message removed (uuid) \u2014 clearing viewer", { uuid: evUuid });
3134
+ } catch {
3135
+ }
3136
+ clearViewer();
3137
+ }
3138
+ return;
3139
+ }
3116
3140
  const folderMatches = ev.folderId == null || currentMessage.folderId == null || ev.folderId === currentMessage.folderId;
3117
3141
  if (ev.accountId === currentAccountId && ev.uid === currentMessage.uid && folderMatches) {
3142
+ try {
3143
+ window.mailxapi?.logClientEvent?.("[fate-share] viewed message removed (uid) \u2014 clearing viewer", { uid: ev.uid, folderId: ev.folderId ?? null });
3144
+ } catch {
3145
+ }
3118
3146
  clearViewer();
3119
3147
  }
3120
3148
  });
@@ -3503,10 +3531,17 @@ function focusRow(row, opts = {}) {
3503
3531
  if (opts.scroll !== false) {
3504
3532
  row.el.scrollIntoView({ block: "nearest" });
3505
3533
  }
3506
- showMessage(row.accountId, row.msg.uid, row.msg.folderId, currentSpecialUse || void 0, false, row.msg);
3507
- onMessageSelect(row.accountId, row.msg.uid, row.msg.folderId);
3508
- document.dispatchEvent(new CustomEvent("mailx-focus-changed", { detail: row.msg }));
3509
3534
  rememberPosition();
3535
+ try {
3536
+ showMessage(row.accountId, row.msg.uid, row.msg.folderId, currentSpecialUse || void 0, false, row.msg);
3537
+ onMessageSelect(row.accountId, row.msg.uid, row.msg.folderId);
3538
+ document.dispatchEvent(new CustomEvent("mailx-focus-changed", { detail: row.msg }));
3539
+ } catch (e) {
3540
+ try {
3541
+ logClientEvent("[fate-share] focusRow viewer drive threw", { uid: row.msg?.uid, accountId: row.accountId, err: e?.message || String(e), stack: e?.stack || null });
3542
+ } catch {
3543
+ }
3544
+ }
3510
3545
  }
3511
3546
  function getCurrentFocused() {
3512
3547
  return focusedRow ? focusedRow.msg : null;
@@ -4216,8 +4251,13 @@ async function loadMessages(accountId, folderId, page = 1, specialUse = "", auto
4216
4251
  setMessages(result.items);
4217
4252
  withScrollAnchor(body, () => renderMessages(body, accountId, result.items, { background: !autoSelect }));
4218
4253
  if (autoSelect && focusedRow) {
4219
- const stillThere = result.items.some((m) => m.accountId === focusedRow.accountId && m.uid === focusedRow.msg.uid);
4254
+ const fUuid = focusedRow.msg?.uuid;
4255
+ const stillThere = result.items.some((m) => fUuid && m.uuid ? m.uuid === fUuid : m.accountId === focusedRow.accountId && m.uid === focusedRow.msg.uid);
4220
4256
  if (!stillThere) {
4257
+ try {
4258
+ logClientEvent("[fate-share] focused row gone after foreground load \u2014 clearing viewer", { uid: focusedRow.msg?.uid, uuid: fUuid || null, accountId: focusedRow.accountId });
4259
+ } catch {
4260
+ }
4221
4261
  clearViewer();
4222
4262
  focusedRow = null;
4223
4263
  }
@@ -4313,8 +4353,13 @@ function renderMessages(body, accountId, items, opts = {}) {
4313
4353
  if (focusedRow && !opts.background) {
4314
4354
  const fAcct = focusedRow.accountId;
4315
4355
  const fUid = focusedRow.msg?.uid;
4316
- const stillThere = items.some((m) => (m.accountId || accountId) === fAcct && m.uid === fUid);
4356
+ const fUuid = focusedRow.msg?.uuid;
4357
+ const stillThere = items.some((m) => fUuid && m.uuid ? m.uuid === fUuid : (m.accountId || accountId) === fAcct && m.uid === fUid);
4317
4358
  if (!stillThere) {
4359
+ try {
4360
+ logClientEvent("[fate-share] focused row gone after foreground render \u2014 clearing viewer", { uid: fUid, uuid: fUuid || null, accountId: fAcct });
4361
+ } catch {
4362
+ }
4318
4363
  clearViewer();
4319
4364
  focusedRow = null;
4320
4365
  }
@@ -4339,6 +4384,12 @@ function restoreSelection(body, savedUuid) {
4339
4384
  const uid = Number(row.dataset.uid);
4340
4385
  if (accountId && Number.isFinite(uid)) {
4341
4386
  const switching = focusedRow?.msg?.uuid !== savedUuid;
4387
+ if (switching) {
4388
+ try {
4389
+ logClientEvent("[fate-share] restoreSelection switching viewer", { toUuid: savedUuid, toUid: uid, fromUuid: focusedRow?.msg?.uuid || null });
4390
+ } catch {
4391
+ }
4392
+ }
4342
4393
  focusByIdentity(accountId, uid, { scroll: switching });
4343
4394
  }
4344
4395
  }