This repository was archived by the owner on Oct 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed
Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,6 @@ export default class Grid extends React.Component {
1313
1414 gridInst = null ;
1515
16- componentDidMount ( ) {
17- this . gridInst = new TuiGrid ( {
18- el : this . rootEl . current ,
19- ...this . props
20- } ) ;
21-
22- this . useAddons ( ) ;
23- this . bindEventHandlers ( ) ;
24- }
25-
2616 useAddons ( ) {
2717 const { addon} = this . props ;
2818
@@ -50,8 +40,21 @@ export default class Grid extends React.Component {
5040 return this . rootEl . current ;
5141 }
5242
43+ componentDidMount ( ) {
44+ this . gridInst = new TuiGrid ( {
45+ el : this . rootEl . current ,
46+ ...this . props
47+ } ) ;
48+
49+ this . useAddons ( ) ;
50+ this . bindEventHandlers ( ) ;
51+ }
52+
5353 shouldComponentUpdate ( nextProps ) {
54- const reactiveProps = this . props . reactiveProps || Object . keys ( reactivePropSetterMap ) ;
54+ const { oneTimeBindingProps = [ ] } = this . props ;
55+ const reactiveProps = Object . keys ( reactivePropSetterMap ) . filter (
56+ ( propName ) => oneTimeBindingProps . indexOf ( propName ) === - 1
57+ ) ;
5558
5659 reactiveProps . forEach ( ( propName ) => {
5760 const currentValue = this . props [ propName ] ;
Original file line number Diff line number Diff line change @@ -129,12 +129,7 @@ stories.add('Reactive Props', () => {
129129 min : 0 ,
130130 max : 4
131131 } ) ;
132- const reactivePropsValue = array ( 'reactiveProps' , [
133- 'columns' ,
134- 'data' ,
135- 'bodyHeight' ,
136- 'frozenColumnCount'
137- ] ) ;
132+ const reactivePropsValue = array ( 'reactiveProps' , [ ] ) ;
138133
139134 return (
140135 < Grid
@@ -143,7 +138,7 @@ stories.add('Reactive Props', () => {
143138 pagination = { false }
144139 bodyHeight = { bodyHeightValue }
145140 frozenColumnCount = { frozenColumnCountValue }
146- reactiveProps = { reactivePropsValue }
141+ oneTimeBindingProps = { reactivePropsValue }
147142 />
148143 ) ;
149144} ) ;
You can’t perform that action at this time.
0 commit comments