From bf3b19fcb9ff4b7ae61e174a1da66ceb83e7d0fb Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Fri, 24 Apr 2026 14:47:52 +0100 Subject: [PATCH] Fix TypeScript error: podcastStatus circular type reference useQuery + refetchInterval callback avoids self-reference. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/app/notebooks/[id]/page.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/notebooks/[id]/page.tsx b/frontend/src/app/notebooks/[id]/page.tsx index 7a5d683..3ccae34 100644 --- a/frontend/src/app/notebooks/[id]/page.tsx +++ b/frontend/src/app/notebooks/[id]/page.tsx @@ -3,6 +3,7 @@ import { useState, useRef, useEffect, useCallback, useMemo } from 'react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { notebookAPI, documentAPI, authAPI } from '@/lib/api'; +import type { PodcastStatus } from '@/types'; import { useParams } from 'next/navigation'; import Link from 'next/link'; import { @@ -88,14 +89,13 @@ export default function NotebookDetailPage() { refetchInterval: hasProcessingTasks ? 2000 : false, }); - const { data: podcastStatus } = useQuery({ + const { data: podcastStatus } = useQuery({ queryKey: ['podcast-status', notebookId], queryFn: async () => { const response = await notebookAPI.getPodcastStatus(notebookId); return response.data; }, - // Poll only while a podcast is actively generating; initial load via refetchOnMount - refetchInterval: podcastStatus?.status === 'processing' ? 5000 : false, + refetchInterval: (query) => query.state.data?.status === 'processing' ? 5000 : false, }); const { data: shares } = useQuery({