Fixed: Removed items in queue still showing until refresh
This commit is contained in:
parent
7f7d196e44
commit
479baf06a7
|
@ -73,10 +73,6 @@ 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;
|
||||
|
||||
newState.items = [...items];
|
||||
|
@ -96,6 +92,7 @@ export default function createHandleActions(handlers, defaultState, section) {
|
|||
} else if (!updateOnly) {
|
||||
const newIndex = newState.items.push({ ...otherProps }) - 1;
|
||||
|
||||
newState.itemMap = { ...newState.itemMap };
|
||||
newState.itemMap[payload.id] = newIndex;
|
||||
}
|
||||
|
||||
|
@ -152,7 +149,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));
|
||||
|
|
Loading…
Reference in New Issue