courrier multi account restore compose
This commit is contained in:
parent
ab75d01666
commit
2f53564b1a
@ -391,31 +391,31 @@ export default function CourrierPage() {
|
|||||||
// Update accounts state
|
// Update accounts state
|
||||||
setAccounts(updatedAccounts);
|
setAccounts(updatedAccounts);
|
||||||
console.log('[DEBUG] Updated accounts:', 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 {
|
} else {
|
||||||
// User is authenticated but doesn't have email credentials
|
// User is authenticated but doesn't have email credentials
|
||||||
setShowLoginNeeded(true);
|
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
|
// Preload first page of emails for faster initial rendering
|
||||||
if (session?.user?.id) {
|
if (session?.user?.id) {
|
||||||
await loadEmails();
|
await loadEmails();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user