fix: fixed error during item rename

This commit is contained in:
Anoop M D 2022-10-16 14:51:47 +05:30
parent 6380797f92
commit 6a36313e0e

View File

@ -331,7 +331,8 @@ export const renameItem = (newName, itemUid, collectionUid) => (dispatch, getSta
return reject(new Error('Collection not found'));
}
const item = findItemInCollection(collection, itemUid);
const collectionCopy = cloneDeep(collection);
const item = findItemInCollection(collectionCopy, itemUid);
if(!item) {
return reject(new Error("Unable to locate item"));
}
@ -356,10 +357,7 @@ export const renameItem = (newName, itemUid, collectionUid) => (dispatch, getSta
return;
}
const collectionCopy = cloneDeep(collection);
if(item) {
item.name = newName;
}
item.name = newName;
const collectionToSave = transformCollectionToSaveToIdb(collectionCopy, {
ignoreDraft: true
});