diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 2522b4f0a1772dcdca7f68ee9bdeff12d39e7c8c..b7782f7c1fe924df02d287112dd4c0fc6f0fc351 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -18,10 +18,14 @@ export default class SiderMenu extends PureComponent { } static getDerivedStateFromProps(props, state) { - const { pathname } = state; - if (props.location.pathname !== pathname) { + const { pathname, flatMenuKeysLen } = state; + if ( + props.location.pathname !== pathname || + props.flatMenuKeys.length !== flatMenuKeysLen + ) { return { pathname: props.location.pathname, + flatMenuKeysLen: props.flatMenuKeys.length, openKeys: getDefaultCollapsedSubMenus(props), }; }