mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-23 14:17:46 -04:00
Fix crash when navigating from history view and open the history modal
This commit is contained in:
parent
3c53db7353
commit
98937a0378
3 changed files with 16 additions and 10 deletions
|
@ -99,7 +99,8 @@ export function useEpisodeDeleteBlacklist() {
|
|||
export function useEpisodeHistoryPagination() {
|
||||
return usePaginationQuery(
|
||||
[QueryKeys.Series, QueryKeys.Episodes, QueryKeys.History],
|
||||
(param) => api.episodes.history(param)
|
||||
(param) => api.episodes.history(param),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,10 @@ export function useMovieDeleteBlacklist() {
|
|||
}
|
||||
|
||||
export function useMovieHistoryPagination() {
|
||||
return usePaginationQuery([QueryKeys.Movies, QueryKeys.History], (param) =>
|
||||
api.movies.history(param)
|
||||
return usePaginationQuery(
|
||||
[QueryKeys.Movies, QueryKeys.History],
|
||||
(param) => api.movies.history(param),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ export function usePaginationQuery<
|
|||
TQueryKey extends QueryKey = QueryKey
|
||||
>(
|
||||
queryKey: TQueryKey,
|
||||
queryFn: RangeQuery<TObject>
|
||||
queryFn: RangeQuery<TObject>,
|
||||
cacheIndividual = false
|
||||
): UsePaginationQueryResult<TObject> {
|
||||
const client = useQueryClient();
|
||||
|
||||
|
@ -49,12 +50,14 @@ export function usePaginationQuery<
|
|||
},
|
||||
{
|
||||
onSuccess: ({ data }) => {
|
||||
data.forEach((item) => {
|
||||
const id = GetItemId(item);
|
||||
if (id) {
|
||||
client.setQueryData([...queryKey, id], item);
|
||||
}
|
||||
});
|
||||
if (cacheIndividual) {
|
||||
data.forEach((item) => {
|
||||
const id = GetItemId(item);
|
||||
if (id) {
|
||||
client.setQueryData([...queryKey, id], item);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue