courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 12:14:20 +02:00
parent d683458213
commit f1adfca1d9

View File

@ -245,7 +245,6 @@ export default function CourrierPage() {
console.log('allAccounts is array:', Array.isArray(data.allAccounts)); console.log('allAccounts is array:', Array.isArray(data.allAccounts));
console.log('allAccounts length:', data.allAccounts?.length || 0); console.log('allAccounts length:', data.allAccounts?.length || 0);
// Inspect each account's structure
if (data.authenticated) { if (data.authenticated) {
if (data.hasEmailCredentials) { if (data.hasEmailCredentials) {
console.log('Session initialized, prefetch status:', data.prefetchStarted ? 'running' : 'not started'); console.log('Session initialized, prefetch status:', data.prefetchStarted ? 'running' : 'not started');
@ -330,11 +329,12 @@ export default function CourrierPage() {
console.log('Auto-selecting account:', updatedAccounts[1]); console.log('Auto-selecting account:', updatedAccounts[1]);
setSelectedAccount(updatedAccounts[1]); setSelectedAccount(updatedAccounts[1]);
setShowFolders(true); setShowFolders(true);
}
// Preload first page of emails for faster initial rendering // Load emails for the selected account
if (session?.user?.id) { if (session?.user?.id) {
await loadEmails(); await loadEmails();
}
}
// If the user hasn't opened this page recently, trigger a background refresh // If the user hasn't opened this page recently, trigger a background refresh
if (data.lastVisit && Date.now() - data.lastVisit > 5 * 60 * 1000) { if (data.lastVisit && Date.now() - data.lastVisit > 5 * 60 * 1000) {
@ -350,7 +350,6 @@ export default function CourrierPage() {
console.error('Failed to trigger background refresh', error); console.error('Failed to trigger background refresh', error);
} }
} }
}
} else { } else {
// User is authenticated but doesn't have email credentials // User is authenticated but doesn't have email credentials
setShowLoginNeeded(true); setShowLoginNeeded(true);