@linzjs/step-ag-grid 27.2.0 → 27.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5058,7 +5058,7 @@ const GridContextProvider = (props) => {
5058
5058
  if (!noApiFn) {
5059
5059
  noApiFn = (() => { });
5060
5060
  }
5061
- return gridApi ? hasApiFn(gridApi) : noApiFn();
5061
+ return gridApi && !gridApi.isDestroyed() ? hasApiFn(gridApi) : noApiFn();
5062
5062
  }, [gridApi]);
5063
5063
  /**
5064
5064
  * Scroll row into view by Id.
@@ -5223,9 +5223,9 @@ const GridContextProvider = (props) => {
5223
5223
  // as they will start to edit the cell before this stuff has a chance to run
5224
5224
  colId &&
5225
5225
  delay(() => {
5226
- if (isEmpty(gridApi.getEditingCells()) &&
5227
- (!ifNoCellFocused || gridApi.getFocusedCell() == null) &&
5228
- !gridApi.isDestroyed()) {
5226
+ if (!gridApi.isDestroyed() &&
5227
+ isEmpty(gridApi.getEditingCells()) &&
5228
+ (!ifNoCellFocused || gridApi.getFocusedCell() == null)) {
5229
5229
  gridApi.setFocusedCell(rowIndex, colId);
5230
5230
  // It may be that the first cell is the selection cell, this doesn't exist as a colDef
5231
5231
  // so instead, I just try and select it. If it doesn't exist selection will stay on the
@@ -5330,7 +5330,9 @@ const GridContextProvider = (props) => {
5330
5330
  * Resize columns to fit container
5331
5331
  */
5332
5332
  const sizeColumnsToFit = useCallback(() => {
5333
- gridApi?.sizeColumnsToFit();
5333
+ if (gridApi && !gridApi?.isDestroyed()) {
5334
+ gridApi.sizeColumnsToFit();
5335
+ }
5334
5336
  }, [gridApi]);
5335
5337
  const stopEditing = useCallback(() => {
5336
5338
  if (!gridApi || gridApi.isDestroyed()) {
@@ -5477,6 +5479,9 @@ const GridContextProvider = (props) => {
5477
5479
  // I've left them here just in case they are
5478
5480
  // async processes need to refresh their own rows
5479
5481
  // gridApi.refreshCells({ rowNodes: selectedRows as RowNode[], force: true });
5482
+ if (gridApi.isDestroyed()) {
5483
+ return ok;
5484
+ }
5480
5485
  if (ok) {
5481
5486
  const cell = gridApi.getFocusedCell();
5482
5487
  if (cell && gridApi.getFocusedCell() == null) {