mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 08:13:50 +00:00
The list context-menu wiring called selectEmail(email) then invoked handleForwardAsAttachment() synchronously in the same tick. Since handleForwardAsAttachment read selectedEmail from its own closure, and Zustand's store update doesn't propagate into this render's closure until the next render, this could forward the previously selected message (or no-op if nothing was selected yet) instead of the row the user actually right-clicked. Parameterize handleForwardAsAttachment to accept an explicit `email` (defaulting to selectedEmail), the same pattern handleDelete already uses in this file for the same class of problem, and pass it explicitly from the list context-menu wiring. The EmailViewer overflow menu's wiring is unaffected - it always operates on the single currently-open email via the default parameter. Caught by GitHub Copilot's automated PR review.