11import { FileSelect } from './FileSelect' ;
22import { LanguageSelect } from './LanguageSelect' ;
3- import { useQuery , useMutation } from '@tanstack/react-query' ;
3+ import { useQuery , useMutation , useQueryClient } from '@tanstack/react-query' ;
44import * as api from '../lib/api' ;
55import { normalizeLanguageCode } from '../lib/utils/languages' ;
66import { useState } from 'react' ;
@@ -36,6 +36,7 @@ export function VideoExtractor({
3636 onClearStatus,
3737} : Props ) {
3838 const [ updatePlex , setUpdatePlex ] = useState ( true ) ;
39+ const queryClient = useQueryClient ( ) ;
3940
4041 const { data : videos } = useQuery ( {
4142 queryKey : [ 'videos' , type , show , season ] ,
@@ -92,7 +93,7 @@ export function VideoExtractor({
9293 }
9394
9495 return translatedPath ;
95- } catch ( error ) {
96+ } catch ( error : any ) { // Added type annotation to error
9697 console . log ( 'Extraction error:' , error ) ;
9798 if ( error . response ) {
9899 const originalMessage = error . response . data . message ;
@@ -105,8 +106,12 @@ export function VideoExtractor({
105106 throw error ;
106107 }
107108 } ,
108- onSuccess : ( path ) => {
109+ onSuccess : ( path : string ) => { // Added type annotation to path
109110 onTranslationComplete ( path ) ;
111+ // Wait a bit for DeepL API to update usage stats
112+ setTimeout ( ( ) => {
113+ queryClient . invalidateQueries ( { queryKey : [ 'character-count' ] } ) ;
114+ } , 2000 ) ; // 2-second delay
110115 } ,
111116 } ) ;
112117
0 commit comments