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 { ...@@ -15,9 +15,7 @@ export default class Info extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { match, location } = props; const { match, location } = props;
this.state = { const menuMap = {
mode: 'inline',
menuMap: {
base: <FormattedMessage id="app.settings.menuMap.basic" defaultMessage="Basic Settings" />, base: <FormattedMessage id="app.settings.menuMap.basic" defaultMessage="Basic Settings" />,
security: ( security: (
<FormattedMessage id="app.settings.menuMap.security" defaultMessage="Security Settings" /> <FormattedMessage id="app.settings.menuMap.security" defaultMessage="Security Settings" />
...@@ -31,14 +29,13 @@ export default class Info extends Component { ...@@ -31,14 +29,13 @@ export default class Info extends Component {
defaultMessage="New Message Notification" defaultMessage="New Message Notification"
/> />
), ),
},
}; };
let key = location.pathname.replace(`${match.path}/`, ''); const key = location.pathname.replace(`${match.path}/`, '');
const { menuMap } = this.state; this.state = {
key = menuMap[key] ? key : 'base'; mode: 'inline',
this.setState({ menuMap,
selectKey: key, selectKey: menuMap[key] ? key : 'base',
}); };
} }
static getDerivedStateFromProps(props, state) { 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