@homebound/beam 2.174.0 → 2.174.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.
@@ -32,14 +32,20 @@ function useSetupColumnSizes(style, columns, resizeRef) {
32
32
  const calculateImmediately = (0, react_1.useRef)(true);
33
33
  const [tableWidth, setTableWidth] = (0, react_1.useState)();
34
34
  // Calc our initial/first render sizes where we won't have a width yet
35
- const [columnSizes, setColumnSizes] = (0, react_1.useState)(
36
- // TODO Add a useEffect to re-calc this on change
37
- (0, GridTable_1.calcColumnSizes)(columns, (_a = style.nestedCards) === null || _a === void 0 ? void 0 : _a.firstLastColumnWidth, tableWidth, style.minWidthPx));
35
+ const [columnSizes, setColumnSizes] = (0, react_1.useState)((0, GridTable_1.calcColumnSizes)(columns, (_a = style.nestedCards) === null || _a === void 0 ? void 0 : _a.firstLastColumnWidth, tableWidth, style.minWidthPx));
38
36
  const setTableAndColumnWidths = (0, react_1.useCallback)((width) => {
39
37
  var _a;
40
38
  setTableWidth(width);
41
39
  setColumnSizes((0, GridTable_1.calcColumnSizes)(columns, (_a = style.nestedCards) === null || _a === void 0 ? void 0 : _a.firstLastColumnWidth, width, style.minWidthPx));
42
40
  }, [setTableWidth, setColumnSizes, columns, style]);
41
+ // Used to recalculate our columns sizes when columns change
42
+ (0, react_1.useEffect)(() => {
43
+ var _a;
44
+ if (!calculateImmediately.current) {
45
+ const width = (_a = resizeRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
46
+ width && setTableAndColumnWidths(width);
47
+ }
48
+ }, [columns, setTableAndColumnWidths]);
43
49
  const setTableAndColumnWidthsDebounced = (0, use_debounce_1.useDebouncedCallback)(setTableAndColumnWidths, 100);
44
50
  const onResize = (0, react_1.useCallback)(() => {
45
51
  const target = resizeRef.current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.174.0",
3
+ "version": "2.174.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",