mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-23 13:57:06 -04:00
Small change to creating an itemMap during item update
This commit is contained in:
parent
97ec184754
commit
7f28ab895a
1 changed files with 5 additions and 1 deletions
|
@ -72,8 +72,12 @@ export default function createHandleActions(handlers, defaultState, section) {
|
|||
if (section === baseSection) {
|
||||
const newState = getSectionState(state, payloadSection);
|
||||
const items = newState.items;
|
||||
const itemMap = newState.itemMap ?? {};
|
||||
|
||||
// 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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue