File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import classNames from 'classnames' ;
2
2
import isEqual from 'lodash/isEqual' ;
3
+ import memoize from 'lodash/memoize' ;
3
4
import { nanoid } from 'nanoid' ;
4
5
import PropTypes from 'prop-types' ;
5
6
import React from 'react' ;
@@ -102,6 +103,8 @@ class CheckboxTree extends React.Component {
102
103
this . onNodeClick = this . onNodeClick . bind ( this ) ;
103
104
this . onExpandAll = this . onExpandAll . bind ( this ) ;
104
105
this . onCollapseAll = this . onCollapseAll . bind ( this ) ;
106
+
107
+ this . combineMemorized = memoize ( ( icons1 , icons2 ) => ( { ...icons1 , ...icons2 } ) ) . bind ( this ) ;
105
108
}
106
109
107
110
// eslint-disable-next-line react/sort-comp
@@ -250,7 +253,7 @@ class CheckboxTree extends React.Component {
250
253
expandOnClick = { expandOnClick }
251
254
expanded = { flatNode . expanded }
252
255
icon = { node . icon }
253
- icons = { { ... defaultIcons , ... icons } }
256
+ icons = { this . combineMemorized ( defaultIcons , icons ) }
254
257
label = { node . label }
255
258
lang = { lang }
256
259
optimisticToggle = { optimisticToggle }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import NativeCheckbox from './NativeCheckbox';
7
7
import iconsShape from './shapes/iconsShape' ;
8
8
import languageShape from './shapes/languageShape' ;
9
9
10
- class TreeNode extends React . Component {
10
+ class TreeNode extends React . PureComponent {
11
11
static propTypes = {
12
12
checked : PropTypes . number . isRequired ,
13
13
disabled : PropTypes . bool . isRequired ,
You can’t perform that action at this time.
0 commit comments