File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ class TableRow extends React.Component {
56
56
super ( props ) ;
57
57
58
58
this . shouldRender = props . visible ;
59
+
60
+ // avoid creating new object which may fail the sCU.
61
+ this . style = { } ;
59
62
}
60
63
61
64
componentWillReceiveProps ( nextProps ) {
@@ -99,6 +102,20 @@ class TableRow extends React.Component {
99
102
store . setState ( { expandedRowsHeight } ) ;
100
103
}
101
104
105
+ getStyle ( ) {
106
+ const { height, visible } = this . props ;
107
+
108
+ if ( height && height !== this . style . height ) {
109
+ this . style = { ...this . style , height } ;
110
+ }
111
+
112
+ if ( ! visible && ! this . style . display ) {
113
+ this . style = { ...this . style , display : 'none' } ;
114
+ }
115
+
116
+ return this . style ;
117
+ }
118
+
102
119
saveRowRef = ( node ) => {
103
120
this . rowRef = node ;
104
121
if ( node ) {
@@ -120,8 +137,6 @@ class TableRow extends React.Component {
120
137
index,
121
138
indent,
122
139
indentSize,
123
- visible,
124
- height,
125
140
hovered,
126
141
hasExpandIcon,
127
142
renderExpandIcon,
@@ -153,12 +168,6 @@ class TableRow extends React.Component {
153
168
) ;
154
169
}
155
170
156
- const style = { height } ;
157
-
158
- if ( ! visible ) {
159
- style . display = 'none' ;
160
- }
161
-
162
171
const rowClassName =
163
172
`${ prefixCls } ${ className } ${ prefixCls } -level-${ indent } ` . trim ( ) ;
164
173
@@ -171,7 +180,7 @@ class TableRow extends React.Component {
171
180
onMouseLeave = { this . onMouseLeave }
172
181
onContextMenu = { this . onContextMenu }
173
182
className = { rowClassName }
174
- style = { style }
183
+ style = { this . getStyle ( ) }
175
184
>
176
185
{ cells }
177
186
</ tr >
You can’t perform that action at this time.
0 commit comments