@linzjs/step-ag-grid 29.3.3 → 29.3.4

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": "29.3.3",
5
+ "version": "29.3.4",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -30,7 +30,7 @@ import { defer, delay, difference, isEmpty, last, omit, xorBy } from 'lodash-es'
30
30
  import { ReactElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
31
31
  import { useInterval } from 'usehooks-ts';
32
32
 
33
- import { AutoSizeColumnsResult, useGridContext } from '../contexts/GridContext';
33
+ import { AutoSizeColumnsResult, StartCellEditingProps, useGridContext } from '../contexts/GridContext';
34
34
  import { GridUpdatingContext } from '../contexts/GridUpdatingContext';
35
35
  import { fnOrVar, isNotEmpty } from '../utils/util';
36
36
  import { clickInputWhenContainingCellClicked } from './clickInputWhenContainingCellClicked';
@@ -170,8 +170,18 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
170
170
  getColDef,
171
171
  showNoRowsOverlay,
172
172
  prePopupOps,
173
- startCellEditing,
173
+ startCellEditing: propStartCellEditing,
174
174
  } = useGridContext<TData>();
175
+ // CellEditingStop event happens too much for one edit
176
+ const startedEditRef = useRef(false);
177
+ const startCellEditing = useCallback(
178
+ (props: StartCellEditingProps) => {
179
+ startedEditRef.current = true;
180
+ return propStartCellEditing(props);
181
+ },
182
+ [propStartCellEditing],
183
+ );
184
+
175
185
  const { updatedDep, anyUpdating, updatingCols } = useContext(GridUpdatingContext);
176
186
 
177
187
  const gridDivRef = useRef<HTMLDivElement>(null);
@@ -497,6 +507,10 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
497
507
 
498
508
  const onCellEditingStopped = useCallback(
499
509
  (event: AgGridEvent<TData>) => {
510
+ if (!startedEditRef.current) {
511
+ return;
512
+ }
513
+ startedEditRef.current = false;
500
514
  const api = event.api;
501
515
  // We need to redraw on fit as the updated row heights aren't visible
502
516
  if (sizeColumns === 'fit') {