diff --git a/src/components/GenerateCourse/GetAICourse.tsx b/src/components/GenerateCourse/GetAICourse.tsx index 14296e177..fdff79692 100644 --- a/src/components/GenerateCourse/GetAICourse.tsx +++ b/src/components/GenerateCourse/GetAICourse.tsx @@ -1,5 +1,8 @@ import { useQuery } from '@tanstack/react-query'; -import { getAiCourseOptions } from '../../queries/ai-course'; +import { + getAiCourseOptions, + getAiCourseProgressOptions, +} from '../../queries/ai-course'; import { queryClient } from '../../stores/query-client'; import { useEffect, useState } from 'react'; import { AICourseContent } from './AICourseContent'; @@ -73,7 +76,16 @@ export function GetAICourse(props: GetAICourseProps) { }, ); }, - onLoadingChange: setIsRegenerating, + onLoadingChange: (isNewLoading) => { + setIsRegenerating(isNewLoading); + if (!isNewLoading) { + queryClient.invalidateQueries({ + queryKey: getAiCourseProgressOptions({ + aiCourseSlug: courseSlug, + }).queryKey, + }); + } + }, onError: setError, isForce: true, }); diff --git a/src/components/GenerateCourse/re-generate b/src/components/GenerateCourse/re-generate deleted file mode 100644 index e69de29bb..000000000