diff --git a/packages/client/src/pages/Settings/Section/Body/index.js b/packages/client/src/pages/Settings/Section/Body/index.js
index 859a68b362..4d69ab18a7 100644
--- a/packages/client/src/pages/Settings/Section/Body/index.js
+++ b/packages/client/src/pages/Settings/Section/Body/index.js
@@ -1,4 +1,4 @@
-import React, { useCallback } from "react";
+import React, { useState, useCallback, useEffect } from "react";
import { useTranslation } from "react-i18next";
import styled, { css } from "styled-components";
import { withRouter } from "react-router";
@@ -44,6 +44,15 @@ const SectionBodyContent = ({ isErrorSettings, history, user }) => {
content: ,
};
+ const defaultStartSelect =
+ setting === "common" ? commonSettings : adminSettings;
+
+ const [startSelect, setStartSelect] = useState(defaultStartSelect);
+
+ useEffect(() => {
+ setStartSelect(defaultStartSelect);
+ }, [setting]);
+
const data = [adminSettings, commonSettings];
const onSelect = useCallback(
@@ -76,11 +85,7 @@ const SectionBodyContent = ({ isErrorSettings, history, user }) => {
showAdminSettings={showAdminSettings}
/>
) : (
-
+
)}
);
diff --git a/packages/components/submenu/index.js b/packages/components/submenu/index.js
index 931fac7a81..beb2492dc2 100644
--- a/packages/components/submenu/index.js
+++ b/packages/components/submenu/index.js
@@ -22,9 +22,13 @@ const Submenu = (props) => {
} = props;
if (!data) return null;
- const [currentItem, setCurrentItem] = useState(
- data[startSelect] || startSelect || null
- );
+ const defaultCurrentItem = data[startSelect] || startSelect || null;
+
+ const [currentItem, setCurrentItem] = useState(defaultCurrentItem);
+
+ useEffect(() => {
+ setCurrentItem(defaultCurrentItem);
+ }, [startSelect.id]);
const submenuItemsRef = useRef();