feat: auto-fetch full email content when an email is auto-selected
This commit is contained in:
@@ -109,6 +109,7 @@ export default function Home() {
|
|||||||
selectKeyword,
|
selectKeyword,
|
||||||
hasMoreEmails,
|
hasMoreEmails,
|
||||||
fetchTagCounts,
|
fetchTagCounts,
|
||||||
|
fetchEmailContent,
|
||||||
} = useEmailStore();
|
} = useEmailStore();
|
||||||
|
|
||||||
// Keyboard shortcuts handlers
|
// Keyboard shortcuts handlers
|
||||||
@@ -336,6 +337,19 @@ export default function Home() {
|
|||||||
};
|
};
|
||||||
}, [isAuthenticated, client, mailboxes.length, fetchMailboxes, fetchEmails, fetchQuota, fetchTagCounts, handleStateChange, setPushConnected]);
|
}, [isAuthenticated, client, mailboxes.length, fetchMailboxes, fetchEmails, fetchQuota, fetchTagCounts, handleStateChange, setPushConnected]);
|
||||||
|
|
||||||
|
// Auto-fetch full email content when an email is auto-selected (e.g. after delete/archive)
|
||||||
|
useEffect(() => {
|
||||||
|
if (!selectedEmail || !client) return;
|
||||||
|
// If the email lacks bodyValues, it was auto-selected from the list and needs full content
|
||||||
|
if (!selectedEmail.bodyValues) {
|
||||||
|
setLoadingEmail(true);
|
||||||
|
fetchEmailContent(client, selectedEmail.id).finally(() => {
|
||||||
|
setLoadingEmail(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [selectedEmail?.id]);
|
||||||
|
|
||||||
// Handle mark-as-read with delay based on settings
|
// Handle mark-as-read with delay based on settings
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Clear any existing timeout when email changes
|
// Clear any existing timeout when email changes
|
||||||
|
|||||||
Reference in New Issue
Block a user