Client:Pages:PortalSettigs: add a check for data in tabs

This commit is contained in:
Darya Umrikhina 2024-06-13 16:17:33 +07:00
parent baec28ed6e
commit bcf23b865e
5 changed files with 5 additions and 5 deletions

View File

@ -105,7 +105,7 @@ const TabsCommon = (props) => {
const getCurrentTabId = () => {
const path = location.pathname;
const currentTab = data.find((item) => path.includes(item.id));
return currentTab !== -1 ? currentTab.id : data[0].id;
return currentTab !== -1 && data.length ? currentTab.id : data[0].id;
};
const currentTabId = getCurrentTabId();

View File

@ -122,7 +122,7 @@ const DataManagementWrapper = (props) => {
useEffect(() => {
const path = location.pathname;
const currentTab = data.find((item) => path.includes(item.id));
if (currentTab !== -1) setCurrentTabId(currentTab.id);
if (currentTab !== -1 && data.length) setCurrentTabId(currentTab.id);
setIsLoading(true);
}, [location]);

View File

@ -61,7 +61,7 @@ const DeleteData = (props) => {
useEffect(() => {
const path = location.pathname;
const currentTab = data.find((item) => path.includes(item.id));
if (currentTab !== -1) setCurrentTabId(currentTab.id);
if (currentTab !== -1 && data.length) setCurrentTabId(currentTab.id);
setIsLoading(true);
}, [location]);

View File

@ -116,7 +116,7 @@ const DeveloperToolsWrapper = (props) => {
useEffect(() => {
const path = location.pathname;
const currentTab = data.find((item) => path.includes(item.id));
if (currentTab !== -1) {
if (currentTab !== -1 && data.length) {
setCurrentTabId(currentTab.id);
}

View File

@ -116,7 +116,7 @@ const IntegrationWrapper = (props) => {
const getCurrentTabId = () => {
const path = location.pathname;
const currentTab = data.find((item) => path.includes(item.id));
return currentTab !== -1 ? currentTab.id : data[0].id;
return currentTab !== -1 && data.length ? currentTab.id : data[0].id;
};
const currentTabId = getCurrentTabId();