diff --git a/app/(main)/[locale]/page.tsx b/app/(main)/[locale]/page.tsx index f7896154..c07514fe 100644 --- a/app/(main)/[locale]/page.tsx +++ b/app/(main)/[locale]/page.tsx @@ -3101,11 +3101,13 @@ export default function Home() { onForward={handleForward} onDelete={() => { // Deleting the open message returns to the list (Gmail-style), - // not the next email. Deselect first so the store's - // remove-and-advance sees no selection and doesn't auto-open - // the next message; then delete the captured email. + // not the next email — unless the user turned the setting off. + // Deselect first so the store's remove-and-advance sees no + // selection and doesn't auto-open the next message. const target = selectedEmail; - handleMobileBack(); + if (useSettingsStore.getState().returnToListAfterAction) { + handleMobileBack(); + } handleDelete(target); }} onArchive={() => handleArchive()} diff --git a/components/settings/reading-settings.tsx b/components/settings/reading-settings.tsx index f74aa045..1a54f8f1 100644 --- a/components/settings/reading-settings.tsx +++ b/components/settings/reading-settings.tsx @@ -22,6 +22,7 @@ export function ReadingSettings() { markAsReadDelay, deleteAction, permanentlyDeleteJunk, + returnToListAfterAction, showPreview, mailLayout, disableThreading, @@ -176,6 +177,13 @@ export function ReadingSettings() { /> + + updateSetting('returnToListAfterAction', checked)} + /> + + {!isSettingHidden('showPreview') && ( ()( firstDayOfWeek: state.firstDayOfWeek, markAsReadDelay: state.markAsReadDelay, deleteAction: state.deleteAction, + returnToListAfterAction: state.returnToListAfterAction, showPreview: state.showPreview, mailLayout: state.mailLayout, emailsPerPage: state.emailsPerPage,