courrier multi account restore compose

This commit is contained in:
alma 2025-04-30 13:13:12 +02:00
parent f306d94729
commit f0710c474b

View File

@ -396,13 +396,22 @@ export const useCourrier = () => {
// Log what we're doing
console.log(`[PAGINATION] Loading page ${page} for folder ${currentFolder}`);
// Simple approach that doesn't require complex parameter handling
changeFolder(currentFolder)
// CRITICAL FIX: Extract account ID from current folder to ensure pagination uses the correct account
let accountId: string | undefined;
if (currentFolder && currentFolder.includes(':')) {
const parts = currentFolder.split(':');
accountId = parts[0];
console.log(`[PAGINATION] Extracted account ID ${accountId} from folder ${currentFolder}`);
}
// Call changeFolder with explicit account ID when available
changeFolder(currentFolder, accountId)
.catch(err => {
console.error(`[PAGINATION] Error loading more emails:`, err);
});
}
}, [page, session?.user?.id, changeFolder]); // Deliberately NOT including currentFolder here
}, [page, session?.user?.id, changeFolder, currentFolder]); // Include currentFolder for correct account ID extraction
// ADDING DEBUG LOGS to track currentFolder changes
useEffect(() => {