File tree 1 file changed +14
-10
lines changed
1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ class Menu extends React.Component<MenuProps> {
108
108
this . updateMiniStore ( ) ;
109
109
}
110
110
111
- componentDidUpdate ( ) {
112
- this . updateMiniStore ( ) ;
111
+ componentDidUpdate ( prevProps : MenuProps ) {
112
+ this . updateMiniStore ( prevProps ) ;
113
113
}
114
114
115
115
onSelect = ( selectInfo : SelectInfo ) => {
@@ -215,16 +215,20 @@ class Menu extends React.Component<MenuProps> {
215
215
this . innerMenu = node ;
216
216
} ;
217
217
218
- updateMiniStore ( ) {
218
+ updateMiniStore ( prevProps ?: MenuProps ) {
219
219
if ( 'selectedKeys' in this . props ) {
220
- this . store . setState ( {
221
- selectedKeys : this . props . selectedKeys || [ ] ,
222
- } ) ;
220
+ if ( ! prevProps || this . props . selectedKeys !== prevProps . selectedKeys ) {
221
+ this . store . setState ( {
222
+ selectedKeys : this . props . selectedKeys || [ ] ,
223
+ } ) ;
224
+ }
223
225
}
224
- if ( 'openKeys' in this . props ) {
225
- this . store . setState ( {
226
- openKeys : this . props . openKeys || [ ] ,
227
- } ) ;
226
+ if ( 'openKeys' in this . props && this . props . openKeys . length ) {
227
+ if ( ! prevProps || this . props . openKeys !== prevProps . openKeys ) {
228
+ this . store . setState ( {
229
+ openKeys : this . props . openKeys || [ ] ,
230
+ } ) ;
231
+ }
228
232
}
229
233
}
230
234
You can’t perform that action at this time.
0 commit comments