fix: multiple tab collection level settings (#2905)

* added isFolderSettingsOpenedInTabs logic
This commit is contained in:
Pragadesh-45 2024-08-27 11:51:19 +05:30 committed by GitHub
parent b121afe7bb
commit 4ddccefee3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 11 deletions

View File

@ -19,8 +19,8 @@ const FolderSettings = ({ collection, folder }) => {
const setTab = (tab) => { const setTab = (tab) => {
dispatch( dispatch(
updatedFolderSettingsSelectedTab({ updatedFolderSettingsSelectedTab({
collectionUid: collection.uid, collectionUid: collection?.uid,
folderUid: folder.uid, folderUid: folder?.uid,
tab tab
}) })
); );

View File

@ -189,16 +189,28 @@ const CollectionItem = ({ item, collection, searchText }) => {
toast.error('URL is required'); toast.error('URL is required');
} }
}; };
const viewFolderSettings = () => { const viewFolderSettings = () => {
dispatch( if (isItemAFolder(item)) {
addTab({ if (itemIsOpenedInTabs(item, tabs)) {
uid: uuid(), dispatch(
collectionUid: collection.uid, focusTab({
folderUid: item.uid, uid: item.uid
type: 'folder-settings' })
}) );
); return;
}
dispatch(
addTab({
uid: item.uid,
collectionUid: collection.uid,
type: 'folder-settings'
})
);
return;
}
}; };
const requestItems = sortRequestItems(filter(item.items, (i) => isItemARequest(i))); const requestItems = sortRequestItems(filter(item.items, (i) => isItemARequest(i)));
const folderItems = sortFolderItems(filter(item.items, (i) => isItemAFolder(i))); const folderItems = sortFolderItems(filter(item.items, (i) => isItemAFolder(i)));

View File

@ -41,7 +41,7 @@ export const tabsSlice = createSlice({
requestPaneTab: action.payload.requestPaneTab || 'params', requestPaneTab: action.payload.requestPaneTab || 'params',
responsePaneTab: 'response', responsePaneTab: 'response',
type: action.payload.type || 'request', type: action.payload.type || 'request',
...(action.payload.folderUid ? { folderUid: action.payload.folderUid } : {}) ...(action.payload.uid ? { folderUid: action.payload.uid } : {})
}); });
state.activeTabUid = action.payload.uid; state.activeTabUid = action.payload.uid;
}, },