1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-28 23:07:13 -04:00

Fixed: Handle client state of collection missingMovies

This commit is contained in:
ricci2511
2023-06-27 01:31:47 +02:00
committed by Qstick
parent b3f6774820
commit c214a6b67b
4 changed files with 44 additions and 5 deletions
+16 -3
View File
@@ -131,8 +131,7 @@ export const actionHandlers = handleThunks({
promise.done((data) => {
const updatedItem = _.cloneDeep(data);
updatedItem.id = updatedItem.tmdbId;
dispatch(batchActions([
const actions = [
updateItem({ section: 'movies', ...data }),
updateItem({ section: 'addMovie', ...updatedItem }),
@@ -142,7 +141,21 @@ export const actionHandlers = handleThunks({
isAdded: true,
addError: null
})
]));
];
if (!newMovie.collection) {
dispatch(batchActions(actions));
return;
}
const collectionToUpdate = getState().movieCollections.items.find((collection) => collection.tmdbId === newMovie.collection.tmdbId);
if (collectionToUpdate) {
const collectionData = { ...collectionToUpdate, missingMovies: Math.max(0, collectionToUpdate.missingMovies - 1 ) };
actions.push(updateItem({ section: 'movieCollections', ...collectionData }));
}
dispatch(batchActions(actions));
});
promise.fail((xhr) => {