@linzjs/step-ag-grid 27.2.0 → 27.2.2

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.
@@ -5060,7 +5060,7 @@ const GridContextProvider = (props) => {
5060
5060
  if (!noApiFn) {
5061
5061
  noApiFn = (() => { });
5062
5062
  }
5063
- return gridApi ? hasApiFn(gridApi) : noApiFn();
5063
+ return gridApi && !gridApi.isDestroyed() ? hasApiFn(gridApi) : noApiFn();
5064
5064
  }, [gridApi]);
5065
5065
  /**
5066
5066
  * Scroll row into view by Id.
@@ -5225,9 +5225,9 @@ const GridContextProvider = (props) => {
5225
5225
  // as they will start to edit the cell before this stuff has a chance to run
5226
5226
  colId &&
5227
5227
  lodashEs.delay(() => {
5228
- if (lodashEs.isEmpty(gridApi.getEditingCells()) &&
5229
- (!ifNoCellFocused || gridApi.getFocusedCell() == null) &&
5230
- !gridApi.isDestroyed()) {
5228
+ if (!gridApi.isDestroyed() &&
5229
+ lodashEs.isEmpty(gridApi.getEditingCells()) &&
5230
+ (!ifNoCellFocused || gridApi.getFocusedCell() == null)) {
5231
5231
  gridApi.setFocusedCell(rowIndex, colId);
5232
5232
  // It may be that the first cell is the selection cell, this doesn't exist as a colDef
5233
5233
  // so instead, I just try and select it. If it doesn't exist selection will stay on the
@@ -5332,7 +5332,9 @@ const GridContextProvider = (props) => {
5332
5332
  * Resize columns to fit container
5333
5333
  */
5334
5334
  const sizeColumnsToFit = React.useCallback(() => {
5335
- gridApi?.sizeColumnsToFit();
5335
+ if (gridApi && !gridApi?.isDestroyed()) {
5336
+ gridApi.sizeColumnsToFit();
5337
+ }
5336
5338
  }, [gridApi]);
5337
5339
  const stopEditing = React.useCallback(() => {
5338
5340
  if (!gridApi || gridApi.isDestroyed()) {
@@ -5479,6 +5481,9 @@ const GridContextProvider = (props) => {
5479
5481
  // I've left them here just in case they are
5480
5482
  // async processes need to refresh their own rows
5481
5483
  // gridApi.refreshCells({ rowNodes: selectedRows as RowNode[], force: true });
5484
+ if (gridApi.isDestroyed()) {
5485
+ return ok;
5486
+ }
5482
5487
  if (ok) {
5483
5488
  const cell = gridApi.getFocusedCell();
5484
5489
  if (cell && gridApi.getFocusedCell() == null) {
@@ -5513,6 +5518,9 @@ const GridContextProvider = (props) => {
5513
5518
  }
5514
5519
  }, 50), [gridApi]);
5515
5520
  const onFilterChanged = React.useMemo(() => debounce(() => {
5521
+ if (!gridApi || gridApi?.isDestroyed()) {
5522
+ return;
5523
+ }
5516
5524
  // This is terrible, but there's no other way for me to check whether a filter has changed the grid
5517
5525
  const getDisplayedRowsHash = () => {
5518
5526
  const arr = [];