From 1520d6614b1b202cfaac579e3840c945db5e763d Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Sat, 19 Mar 2022 02:33:51 +0800 Subject: Fix episodes are not updated after subtitle action --- frontend/src/apis/hooks/subtitles.ts | 10 +++++++++- frontend/src/types/form.d.ts | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/apis/hooks/subtitles.ts b/frontend/src/apis/hooks/subtitles.ts index 5080daeb7..89626d8f9 100644 --- a/frontend/src/apis/hooks/subtitles.ts +++ b/frontend/src/apis/hooks/subtitles.ts @@ -12,8 +12,16 @@ export function useSubtitleAction() { [QueryKeys.Subtitles], (param: Param) => api.subtitles.modify(param.action, param.form), { - onSuccess: () => { + onSuccess: (_, param) => { client.invalidateQueries([QueryKeys.History]); + + // TODO: Query less + const { type, id } = param.form; + if (type === "episode") { + client.invalidateQueries([QueryKeys.Series, id]); + } else { + client.invalidateQueries([QueryKeys.Movies, id]); + } }, } ); diff --git a/frontend/src/types/form.d.ts b/frontend/src/types/form.d.ts index aff28c170..99b16da88 100644 --- a/frontend/src/types/form.d.ts +++ b/frontend/src/types/form.d.ts @@ -4,7 +4,7 @@ declare namespace FormType { profileid: (number | null)[]; } - type SeriesAction = OneSerieAction | SearchWantedAction; + type SeriesAction = OneSeriesAction | SearchWantedAction; type MoviesAction = OneMovieAction | SearchWantedAction; @@ -13,7 +13,7 @@ declare namespace FormType { radarrid: number; } - interface OneSerieAction { + interface OneSeriesAction { action: "search-missing" | "scan-disk"; seriesid: number; } -- cgit v1.2.3