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 11import classNames from 'classnames' ;
22import isEqual from 'lodash/isEqual' ;
3+ import memoize from 'lodash/memoize' ;
34import { nanoid } from 'nanoid' ;
45import PropTypes from 'prop-types' ;
56import React from 'react' ;
@@ -102,6 +103,8 @@ class CheckboxTree extends React.Component {
102103 this . onNodeClick = this . onNodeClick . bind ( this ) ;
103104 this . onExpandAll = this . onExpandAll . bind ( this ) ;
104105 this . onCollapseAll = this . onCollapseAll . bind ( this ) ;
106+
107+ this . combineMemorized = memoize ( ( icons1 , icons2 ) => ( { ...icons1 , ...icons2 } ) ) . bind ( this ) ;
105108 }
106109
107110 // eslint-disable-next-line react/sort-comp
@@ -250,7 +253,7 @@ class CheckboxTree extends React.Component {
250253 expandOnClick = { expandOnClick }
251254 expanded = { flatNode . expanded }
252255 icon = { node . icon }
253- icons = { { ... defaultIcons , ... icons } }
256+ icons = { this . combineMemorized ( defaultIcons , icons ) }
254257 label = { node . label }
255258 lang = { lang }
256259 optimisticToggle = { optimisticToggle }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import NativeCheckbox from './NativeCheckbox';
77import iconsShape from './shapes/iconsShape' ;
88import languageShape from './shapes/languageShape' ;
99
10- class TreeNode extends React . Component {
10+ class TreeNode extends React . PureComponent {
1111 static propTypes = {
1212 checked : PropTypes . number . isRequired ,
1313 disabled : PropTypes . bool . isRequired ,
You can’t perform that action at this time.
0 commit comments