From 26f965ba929c8d9f93f39037187c999644702f77 Mon Sep 17 00:00:00 2001 From: BSd3v Date: Wed, 1 May 2024 16:08:20 -0400 Subject: [PATCH] fixing #299 --- src/lib/fragments/AgGrid.react.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/lib/fragments/AgGrid.react.js b/src/lib/fragments/AgGrid.react.js index 2cbde70..8daf5d5 100644 --- a/src/lib/fragments/AgGrid.react.js +++ b/src/lib/fragments/AgGrid.react.js @@ -554,9 +554,11 @@ export default class DashAgGrid extends Component { if (rowModelType === 'clientSide') { propsToSet.virtualRowData = this.virtualRowData(); } - propsToSet.columnState = JSON.parse( - JSON.stringify(this.state.gridApi.getColumnState()) - ); + if (!this.state.gridApi.isDestroyed()) { + propsToSet.columnState = JSON.parse( + JSON.stringify(this.state.gridApi.getColumnState()) + ); + } setProps(propsToSet); } @@ -1308,15 +1310,21 @@ export default class DashAgGrid extends Component { if (!this.state.gridApi || !this.state.mounted) { return; } + if (!this.state.gridApi.isDestroyed) { + var columnState = JSON.parse( + JSON.stringify(this.state.gridApi.getColumnState()) + ); - var columnState = JSON.parse( - JSON.stringify(this.state.gridApi.getColumnState()) - ); + this.props.setProps({ + columnState, + updateColumnState: false, + }); + } else { + this.props.setProps({ + updateColumnState: false, + }); + } - this.props.setProps({ - columnState, - updateColumnState: false, - }); } buildArray(arr1, arr2) {