From c102b6e89b503c2d384516ba1fb8b6bda8261517 Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 28 Apr 2025 14:43:39 +0200 Subject: [PATCH] courrier multi account restore compose --- app/courrier/page.tsx | 4 ++-- hooks/use-courrier.ts | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index bdc15f85..07769033 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -507,8 +507,8 @@ export default function CourrierPage() { console.log(`Changing folder to ${folder} for account ${accountId}`); } - // Change folder in the state - changeFolder(folder); + // Change folder in the state, passing the accountId + changeFolder(folder, accountId); setCurrentView(folder); // Start prefetching additional pages for this folder diff --git a/hooks/use-courrier.ts b/hooks/use-courrier.ts index e5601ef0..4bdbcd71 100644 --- a/hooks/use-courrier.ts +++ b/hooks/use-courrier.ts @@ -538,10 +538,11 @@ export const useCourrier = () => { setSelectedEmail(null); setSelectedEmailIds([]); - // Load the emails for this folder - // The loadEmails function will be called by the useEffect above - // due to the dependency on currentFolder - }, []); + // Load the emails for this folder with the correct accountId + if (session?.user?.id) { + loadEmails(false, accountId); + } + }, [session?.user?.id, loadEmails]); // Search emails const searchEmails = useCallback((query: string) => {