mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-25 15:22:42 +00:00
Fixed: Removed items in queue still showing until refresh
Closes #1378 (cherry picked from commit 479baf06a72b46429a80e19208fdc753ce0ed8ba)
This commit is contained in:
parent
50d1810d36
commit
e8f4b5f8b5
1 changed files with 6 additions and 7 deletions
|
@ -73,10 +73,6 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||||
const newState = getSectionState(state, payloadSection);
|
const newState = getSectionState(state, payloadSection);
|
||||||
const items = newState.items;
|
const items = newState.items;
|
||||||
|
|
||||||
if (!newState.itemMap) {
|
|
||||||
newState.itemMap = createItemMap(payload.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
const index = payload.id in newState.itemMap ? newState.itemMap[payload.id] : -1;
|
const index = payload.id in newState.itemMap ? newState.itemMap[payload.id] : -1;
|
||||||
|
|
||||||
newState.items = [...items];
|
newState.items = [...items];
|
||||||
|
@ -94,8 +90,10 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||||
|
|
||||||
newState.items.splice(index, 1, newItem);
|
newState.items.splice(index, 1, newItem);
|
||||||
} else if (!updateOnly) {
|
} else if (!updateOnly) {
|
||||||
newState.items.push({ ...otherProps });
|
const newIndex = newState.items.push({ ...otherProps }) - 1;
|
||||||
newState.itemMap = createItemMap(newState.items);
|
|
||||||
|
newState.itemMap = { ...newState.itemMap };
|
||||||
|
newState.itemMap[payload.id] = newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateSectionState(state, payloadSection, newState);
|
return updateSectionState(state, payloadSection, newState);
|
||||||
|
@ -151,7 +149,8 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||||
const serverState = _.omit(data, ['records']);
|
const serverState = _.omit(data, ['records']);
|
||||||
const calculatedState = {
|
const calculatedState = {
|
||||||
totalPages: Math.max(Math.ceil(data.totalRecords / data.pageSize), 1),
|
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));
|
return updateSectionState(state, payloadSection, Object.assign(newState, serverState, calculatedState));
|
||||||
|
|
Loading…
Reference in a new issue