@@ -130,20 +130,6 @@ export class ReactGrid extends Component<IGridProps, IGridState> {
130130 }
131131 }
132132
133- shouldComponentUpdate ( nextProps : IGridProps ) {
134- if ( this . descriptorsChanged ( this . props . rows , nextProps . rows ) ) {
135- this . reflectNewRowsOrCols ( nextProps . rows , this . grid . rows ) ;
136- }
137- if ( this . descriptorsChanged ( this . props . cols , nextProps . cols ) ) {
138- this . reflectNewRowsOrCols ( nextProps . cols , this . grid . cols ) ;
139- }
140-
141- if ( this . props . data !== nextProps . data ) {
142- this . handleNewData ( nextProps . data ) ;
143- }
144- return false ;
145- }
146-
147133 componentDidMount ( ) {
148134 this . ensureGridContainerInDOM ( ) ;
149135 this . grid . build ( this . gridContainer ) ;
@@ -180,8 +166,24 @@ export class ReactGrid extends Component<IGridProps, IGridState> {
180166 }
181167
182168 // we return false from should update but react may ignore our hint in the future
183- componentDidUpdate ( ) {
169+ componentDidUpdate ( prevProps : IGridProps ) {
184170 this . ensureGridContainerInDOM ( ) ;
171+
172+ const nextProps = this . props ;
173+ if ( this . descriptorsChanged ( prevProps . rows , nextProps . rows ) ) {
174+ this . reflectNewRowsOrCols ( nextProps . rows , this . grid . rows ) ;
175+ }
176+ if ( this . descriptorsChanged ( prevProps . cols , nextProps . cols ) ) {
177+ this . reflectNewRowsOrCols ( nextProps . cols , this . grid . cols ) ;
178+ }
179+
180+ if ( prevProps . data !== nextProps . data ) {
181+ this . handleNewData ( nextProps . data ) ;
182+ }
183+ }
184+
185+ componentWillUnmount ( ) {
186+ this . grid . destroy ( ) ;
185187 }
186188
187189 render ( ) {
0 commit comments