diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index 059991f1..4b286bf6 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -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 });