fix: fixed issue while saving json in local collections

This commit is contained in:
Anoop M D 2022-10-18 04:26:28 +05:30
parent eefef27dec
commit 5fc9bbd729
2 changed files with 11 additions and 8 deletions

View File

@ -102,12 +102,14 @@ const Collection = ({collection, searchText}) => {
}}> }}>
New Folder New Folder
</div> </div>
<div className="dropdown-item" onClick={(e) => { {!isLocal ? (
menuDropdownTippyRef.current.hide(); <div className="dropdown-item" onClick={(e) => {
setShowRenameCollectionModal(true); menuDropdownTippyRef.current.hide();
}}> setShowRenameCollectionModal(true);
Rename }}>
</div> Rename
</div>
) : null}
<div className="dropdown-item" onClick={(e) => { <div className="dropdown-item" onClick={(e) => {
menuDropdownTippyRef.current.hide(); menuDropdownTippyRef.current.hide();
handleExportClick(true); handleExportClick(true);

View File

@ -165,8 +165,10 @@ export const saveRequest = (itemUid, collectionUid) => (dispatch, getState) => {
return reject(new Error('Collection not found')); return reject(new Error('Collection not found'));
} }
const collectionCopy = cloneDeep(collection);
if(isLocalCollection(collection)) { if(isLocalCollection(collection)) {
const item = findItemInCollection(collection, itemUid); const item = findItemInCollection(collectionCopy, itemUid);
if(item) { if(item) {
const itemToSave = transformRequestToSaveToFilesystem(item); const itemToSave = transformRequestToSaveToFilesystem(item);
const { ipcRenderer } = window; const { ipcRenderer } = window;
@ -182,7 +184,6 @@ export const saveRequest = (itemUid, collectionUid) => (dispatch, getState) => {
return; return;
} }
const collectionCopy = cloneDeep(collection);
const collectionToSave = transformCollectionToSaveToIdb(collectionCopy); const collectionToSave = transformCollectionToSaveToIdb(collectionCopy);
collectionSchema collectionSchema