@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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "27.2.0",
5
+ "version": "27.2.2",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -62,7 +62,7 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
62
62
  if (!noApiFn) {
63
63
  noApiFn = (() => {}) as () => R;
64
64
  }
65
- return gridApi ? hasApiFn(gridApi) : noApiFn();
65
+ return gridApi && !gridApi.isDestroyed() ? hasApiFn(gridApi) : noApiFn();
66
66
  },
67
67
  [gridApi],
68
68
  );
@@ -290,9 +290,9 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
290
290
  colId &&
291
291
  delay(() => {
292
292
  if (
293
+ !gridApi.isDestroyed() &&
293
294
  isEmpty(gridApi.getEditingCells()) &&
294
- (!ifNoCellFocused || gridApi.getFocusedCell() == null) &&
295
- !gridApi.isDestroyed()
295
+ (!ifNoCellFocused || gridApi.getFocusedCell() == null)
296
296
  ) {
297
297
  gridApi.setFocusedCell(rowIndex, colId);
298
298
  // It may be that the first cell is the selection cell, this doesn't exist as a colDef
@@ -456,7 +456,9 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
456
456
  * Resize columns to fit container
457
457
  */
458
458
  const sizeColumnsToFit = useCallback((): void => {
459
- gridApi?.sizeColumnsToFit();
459
+ if (gridApi && !gridApi?.isDestroyed()) {
460
+ gridApi.sizeColumnsToFit();
461
+ }
460
462
  }, [gridApi]);
461
463
 
462
464
  const stopEditing = useCallback((): void => {
@@ -640,6 +642,10 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
640
642
  // async processes need to refresh their own rows
641
643
  // gridApi.refreshCells({ rowNodes: selectedRows as RowNode[], force: true });
642
644
 
645
+ if (gridApi.isDestroyed()) {
646
+ return ok;
647
+ }
648
+
643
649
  if (ok) {
644
650
  const cell = gridApi.getFocusedCell();
645
651
  if (cell && gridApi.getFocusedCell() == null) {
@@ -686,6 +692,9 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
686
692
  const onFilterChanged = useMemo(
687
693
  () =>
688
694
  debounce(() => {
695
+ if (!gridApi || gridApi?.isDestroyed()) {
696
+ return;
697
+ }
689
698
  // This is terrible, but there's no other way for me to check whether a filter has changed the grid
690
699
  const getDisplayedRowsHash = () => {
691
700
  const arr: any[] = [];