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 {
5656 super ( props ) ;
5757
5858 this . shouldRender = props . visible ;
59+
60+ // avoid creating new object which may fail the sCU.
61+ this . style = { } ;
5962 }
6063
6164 componentWillReceiveProps ( nextProps ) {
@@ -99,6 +102,20 @@ class TableRow extends React.Component {
99102 store . setState ( { expandedRowsHeight } ) ;
100103 }
101104
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+
102119 saveRowRef = ( node ) => {
103120 this . rowRef = node ;
104121 if ( node ) {
@@ -120,8 +137,6 @@ class TableRow extends React.Component {
120137 index,
121138 indent,
122139 indentSize,
123- visible,
124- height,
125140 hovered,
126141 hasExpandIcon,
127142 renderExpandIcon,
@@ -153,12 +168,6 @@ class TableRow extends React.Component {
153168 ) ;
154169 }
155170
156- const style = { height } ;
157-
158- if ( ! visible ) {
159- style . display = 'none' ;
160- }
161-
162171 const rowClassName =
163172 `${ prefixCls } ${ className } ${ prefixCls } -level-${ indent } ` . trim ( ) ;
164173
@@ -171,7 +180,7 @@ class TableRow extends React.Component {
171180 onMouseLeave = { this . onMouseLeave }
172181 onContextMenu = { this . onContextMenu }
173182 className = { rowClassName }
174- style = { style }
183+ style = { this . getStyle ( ) }
175184 >
176185 { cells }
177186 </ tr >
You can’t perform that action at this time.
0 commit comments