Fix TypeScript error: podcastStatus circular type reference
useQuery<PodcastStatus> + refetchInterval callback avoids self-reference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
096885c87f
commit
bf3b19fcb9
1 changed files with 3 additions and 3 deletions
|
|
@ -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<PodcastStatus>({
|
||||
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({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue