courrier multi account restore compose

This commit is contained in:
alma 2025-04-30 13:12:04 +02:00
parent d838cb9db9
commit 445c90e852

View File

@ -218,14 +218,15 @@ export const useCourrier = () => {
setIsLoading(false);
// Still refresh in background for fresh data
// CRITICAL FIX: Use the same effective account ID for background refresh
console.log(`Starting background refresh with folder ${currentFolder}, account ${effectiveAccountId}`);
// CRITICAL FIX: Use the normalized folder and explicit account ID together for background refresh
// This prevents issues with account switching where the wrong folder prefix remains
console.log(`Starting background refresh with normalized folder=${normalizedFolder}, account=${effectiveAccountId}`);
refreshEmailsInBackground(
session.user.id,
currentFolder,
normalizedFolder, // CRITICAL FIX: Use the normalized folder WITHOUT prefix
currentRequestPage,
perPage,
effectiveAccountId // Always use the effective account ID
effectiveAccountId // Always pass the effective account ID explicitly
).catch(err => {
console.error('Background refresh error:', err);
});