@linzjs/step-ag-grid 14.9.1 → 14.9.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": "14.9.1",
5
+ "version": "14.9.2",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -124,7 +124,7 @@ export const Grid = ({
124
124
  }
125
125
 
126
126
  const headerCellCount = gridDivRef.current?.getElementsByClassName("ag-header-cell-label")?.length;
127
- if (headerCellCount != params.columnDefs.length) {
127
+ if (headerCellCount < 2) {
128
128
  // Don't resize grids until all the columns are visible
129
129
  // as `autoSizeColumns` will fail silently in this case
130
130
  needsAutoSize.current = true;
@@ -43,11 +43,17 @@ interface IntervalHookProps {
43
43
  timeoutMs: number;
44
44
  callback: () => void;
45
45
  }
46
+
46
47
  export const useIntervalHook = ({ callback, timeoutMs }: IntervalHookProps) => {
48
+ const callbackRef = useRef(callback);
49
+ callbackRef.current = callback;
50
+
47
51
  useEffect(() => {
48
- const interval = setInterval(callback, timeoutMs);
52
+ const interval = setInterval(() => {
53
+ callbackRef.current && callbackRef.current();
54
+ }, timeoutMs);
49
55
  return () => {
50
56
  clearInterval(interval);
51
57
  };
52
- });
58
+ }, [timeoutMs]);
53
59
  };