diff --git a/frontend/src/app/notebooks/[id]/page.tsx b/frontend/src/app/notebooks/[id]/page.tsx index 8c5aad5..f289615 100644 --- a/frontend/src/app/notebooks/[id]/page.tsx +++ b/frontend/src/app/notebooks/[id]/page.tsx @@ -65,21 +65,28 @@ export default function NotebookDetailPage() { }); // Load saved synthesis from database - useQuery({ + const { data: loadedSynthesis } = useQuery({ queryKey: ['synthesis', notebookId], queryFn: async () => { try { const response = await notebookAPI.getSynthesis(notebookId); if (response.data && response.data.status !== 'none') { - setSynthesis(response.data); + return response.data; } - return response.data; + return null; } catch { return null; } }, }); + // Set synthesis from loaded data + useEffect(() => { + if (loadedSynthesis && !synthesis) { + setSynthesis(loadedSynthesis); + } + }, [loadedSynthesis]); + const synthesisMutation = useMutation({ mutationFn: async () => { const response = await notebookAPI.generateSynthesis(notebookId);