courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 17:23:40 +02:00
parent ab75d01666
commit 2f53564b1a

View File

@ -391,31 +391,31 @@ export default function CourrierPage() {
// Update accounts state
setAccounts(updatedAccounts);
console.log('[DEBUG] Updated accounts:', updatedAccounts);
// Auto-select the first non-All account if available
if (updatedAccounts.length > 1) {
console.log('Auto-selecting account:', updatedAccounts[1]);
setSelectedAccount(updatedAccounts[1]);
setShowFolders(true);
// Ensure folders are visible for the selected account
setExpandedAccounts(prev => ({
...prev,
[updatedAccounts[1].id]: true
}));
// Set initial selected folder
setSelectedFolders(prev => ({
...prev,
[updatedAccounts[1].id]: 'INBOX'
}));
}
} else {
// User is authenticated but doesn't have email credentials
setShowLoginNeeded(true);
}
}
// Auto-select the first non-All account if available
if (updatedAccounts.length > 1) {
console.log('Auto-selecting account:', updatedAccounts[1]);
setSelectedAccount(updatedAccounts[1]);
setShowFolders(true);
// Ensure folders are visible for the selected account
setExpandedAccounts(prev => ({
...prev,
[updatedAccounts[1].id]: true
}));
// Set initial selected folder
setSelectedFolders(prev => ({
...prev,
[updatedAccounts[1].id]: 'INBOX'
}));
}
// Preload first page of emails for faster initial rendering
if (session?.user?.id) {
await loadEmails();