mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Download History
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
@@ -317,7 +317,7 @@ class QueueRow extends Component {
|
||||
<RemoveQueueItemModal
|
||||
isOpen={isRemoveQueueItemModalOpen}
|
||||
sourceTitle={title}
|
||||
canIgnore={!!(movie)}
|
||||
canIgnore={!!movie}
|
||||
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
||||
onModalClose={this.onRemoveQueueItemModalClose}
|
||||
/>
|
||||
|
@@ -73,11 +73,12 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||
const newState = getSectionState(state, payloadSection);
|
||||
const items = newState.items;
|
||||
|
||||
if (!newState.itemMap) {
|
||||
newState.itemMap = createItemMap(items);
|
||||
}
|
||||
|
||||
const index = payload.id in newState.itemMap ? newState.itemMap[payload.id] : -1;
|
||||
// Client side collections that are created by adding items to an
|
||||
// existing array may not have an itemMap, the array is probably empty,
|
||||
// but on the offchance it's not create a new item map based on the
|
||||
// items in the array.
|
||||
const itemMap = newState.itemMap ?? createItemMap(items);
|
||||
const index = payload.id in itemMap ? itemMap[payload.id] : -1;
|
||||
|
||||
newState.items = [...items];
|
||||
|
||||
@@ -96,6 +97,7 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||
} else if (!updateOnly) {
|
||||
const newIndex = newState.items.push({ ...otherProps }) - 1;
|
||||
|
||||
newState.itemMap = { ...itemMap };
|
||||
newState.itemMap[payload.id] = newIndex;
|
||||
}
|
||||
|
||||
@@ -152,7 +154,8 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||
const serverState = _.omit(data, ['records']);
|
||||
const calculatedState = {
|
||||
totalPages: Math.max(Math.ceil(data.totalRecords / data.pageSize), 1),
|
||||
items: data.records
|
||||
items: data.records,
|
||||
itemMap: createItemMap(data.records)
|
||||
};
|
||||
|
||||
return updateSectionState(state, payloadSection, Object.assign(newState, serverState, calculatedState));
|
||||
|
@@ -187,12 +187,12 @@ export const actionHandlers = handleThunks({
|
||||
const addedIds = [];
|
||||
|
||||
const allNewMovies = ids.reduce((acc, id) => {
|
||||
const item = _.find(items, { id });
|
||||
const item = items.find((i) => i.id === id);
|
||||
const selectedMovie = item.selectedMovie;
|
||||
|
||||
// Make sure we have a selected movie and
|
||||
// the same movie hasn't been added yet.
|
||||
if (selectedMovie && !_.some(acc, { tmdbId: selectedMovie.tmdbId })) {
|
||||
if (selectedMovie && !acc.some((a) => a.tmdbId === selectedMovie.tmdbId)) {
|
||||
const newMovie = getNewMovie(_.cloneDeep(selectedMovie), item);
|
||||
newMovie.path = item.path;
|
||||
|
||||
@@ -268,7 +268,7 @@ export const reducers = createHandleActions({
|
||||
[SET_IMPORT_MOVIE_VALUE]: function(state, { payload }) {
|
||||
const newState = getSectionState(state, section);
|
||||
const items = newState.items;
|
||||
const index = _.findIndex(items, { id: payload.id });
|
||||
const index = items.findIndex((item) => item.id === payload.id);
|
||||
|
||||
newState.items = [...items];
|
||||
|
||||
|
Reference in New Issue
Block a user