Commit c93b0169 authored by afc163's avatar afc163

should not setState before mount

parent b657fc0e
......@@ -15,9 +15,7 @@ export default class Info extends Component {
constructor(props) {
super(props);
const { match, location } = props;
this.state = {
mode: 'inline',
menuMap: {
const menuMap = {
base: <FormattedMessage id="app.settings.menuMap.basic" defaultMessage="Basic Settings" />,
security: (
<FormattedMessage id="app.settings.menuMap.security" defaultMessage="Security Settings" />
......@@ -31,14 +29,13 @@ export default class Info extends Component {
defaultMessage="New Message Notification"
/>
),
},
};
let key = location.pathname.replace(`${match.path}/`, '');
const { menuMap } = this.state;
key = menuMap[key] ? key : 'base';
this.setState({
selectKey: key,
});
const key = location.pathname.replace(`${match.path}/`, '');
this.state = {
mode: 'inline',
menuMap,
selectKey: menuMap[key] ? key : 'base',
};
}
static getDerivedStateFromProps(props, state) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment