diff --git a/src/routes/Account/Settings/Info.js b/src/routes/Account/Settings/Info.js index 149b9f71e52e2f62ae1bc80d8f4a6c7b97543cbe..7c104facbf528817de0391bad6f07e5653d645b5 100644 --- a/src/routes/Account/Settings/Info.js +++ b/src/routes/Account/Settings/Info.js @@ -19,6 +19,15 @@ const menuMap = { currentUser: user.currentUser, })) export default class Info extends Component { + static getDerivedStateFromProps(props, state) { + const { match, location } = props; + let selectKey = location.pathname.replace(`${match.path}/`, ''); + selectKey = menuMap[selectKey] ? selectKey : 'base'; + if (selectKey !== state.selectKey) { + return { selectKey }; + } + return null; + } constructor(props) { super(props); const { match, location } = props;