@bobfrankston/rmfmail 1.1.5 → 1.1.7

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
@@ -2701,10 +2701,10 @@ onWsEvent((event) => {
2701
2701
  }
2702
2702
  }
2703
2703
  });
2704
- // Store-bus consumers (post-refactor). bodyAvailable / messageRemoved
2705
- // previously fanned out via the legacy onEvent({type:...}) channel; the
2706
- // reconciler now publishes directly on storeBus and the wildcard catches
2707
- // both folder:<id> and message:<uuid> topic forms.
2704
+ // Store-bus consumers (post-refactor). The list's mailx-remove-stale
2705
+ // listener handles row-removal + focus-advance atomically; we just
2706
+ // translate bus events into that one signal so there's a single
2707
+ // owner of "row is no longer here."
2708
2708
  subscribeStore("*", (ev) => {
2709
2709
  if (ev.kind === "bodyAvailable" && ev.accountId && ev.uid) {
2710
2710
  // Flip the row's "not-downloaded" dot. Viewer subscribes separately
@@ -2712,8 +2712,17 @@ subscribeStore("*", (ev) => {
2712
2712
  markBodiesCached([{ accountId: ev.accountId, uid: ev.uid }]);
2713
2713
  }
2714
2714
  else if (ev.kind === "messageRemoved" && ev.accountId && ev.uid) {
2715
- // Server-side EXPUNGE (or another device deleted) — yank the row
2716
- // out of the list if it's still rendered.
2715
+ // Server-side EXPUNGE (or another device deleted).
2716
+ document.dispatchEvent(new CustomEvent("mailx-remove-stale", {
2717
+ detail: { accountId: ev.accountId, uid: ev.uid },
2718
+ }));
2719
+ }
2720
+ else if (ev.kind === "messageMoved" && ev.accountId && ev.uid) {
2721
+ // Moved to a different folder — from the current folder's view
2722
+ // it's the same as removal. The list's remove-stale handler
2723
+ // figures out whether it was actually in the current view; if not,
2724
+ // it's a no-op. Local optimistic delete also flows here when the
2725
+ // user hits Del on another device — same handler, same advance.
2717
2726
  document.dispatchEvent(new CustomEvent("mailx-remove-stale", {
2718
2727
  detail: { accountId: ev.accountId, uid: ev.uid },
2719
2728
  }));