@homebound/beam 2.308.1 → 2.309.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.
@@ -77,8 +77,6 @@ export interface GridTableProps<R extends Kinded, X> {
77
77
  filter?: string;
78
78
  /** Caps the client-side filter to a max number of rows. */
79
79
  filterMaxRows?: number;
80
- /** Accepts the number of filtered rows (based on `filter`), for the caller to observe and display if they want. */
81
- setRowCount?: (rowCount: number) => void;
82
80
  /** A combination of CSS settings to set the static look & feel (vs. rowStyles which is per-row styling). */
83
81
  style?: GridStyle | GridStyleDef;
84
82
  /**
@@ -85,7 +85,7 @@ exports.setGridTableDefaults = setGridTableDefaults;
85
85
  */
86
86
  function GridTable(props) {
87
87
  var _a, _b, _c;
88
- const { id = "gridTable", as = "div", columns: _columns, rows, style: maybeStyle = defaults.style, rowStyles, stickyHeader = defaults.stickyHeader, stickyOffset = 0, xss, filter, filterMaxRows, fallbackMessage = "No rows found.", infoMessage, setRowCount, persistCollapse, resizeTarget, activeRowId, activeCellId, visibleColumnsStorageKey, infiniteScroll, } = props;
88
+ const { id = "gridTable", as = "div", columns: _columns, rows, style: maybeStyle = defaults.style, rowStyles, stickyHeader = defaults.stickyHeader, stickyOffset = 0, xss, filter, filterMaxRows, fallbackMessage = "No rows found.", infoMessage, persistCollapse, resizeTarget, activeRowId, activeCellId, visibleColumnsStorageKey, infiniteScroll, } = props;
89
89
  const columnsWithIds = (0, react_1.useMemo)(() => (0, columns_1.assignDefaultColumnIds)(_columns), [_columns]);
90
90
  // We only use this in as=virtual mode, but keep this here for rowLookup to use
91
91
  const virtuosoRef = (0, react_1.useRef)(null);
@@ -195,10 +195,6 @@ function GridTable(props) {
195
195
  // Refs are cheap to assign to, so we don't bother doing this in a useEffect
196
196
  rowLookup.current = (0, GridRowLookup_1.createRowLookup)(columns, visibleDataRows, virtuosoRef);
197
197
  }
198
- // TODO: Replace setRowCount with clients observing TableState via the API
199
- (0, react_1.useEffect)(() => {
200
- setRowCount && (visibleDataRows === null || visibleDataRows === void 0 ? void 0 : visibleDataRows.length) !== undefined && setRowCount(visibleDataRows.length);
201
- }, [visibleDataRows === null || visibleDataRows === void 0 ? void 0 : visibleDataRows.length, setRowCount]);
202
198
  const noData = visibleDataRows.length === 0;
203
199
  const firstRowMessage = (noData && fallbackMessage) || (tooManyClientSideRows && "Hiding some rows, use filter...") || infoMessage;
204
200
  const borderless = (_a = style === null || style === void 0 ? void 0 : style.presentationSettings) === null || _a === void 0 ? void 0 : _a.borderless;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useComputed = void 0;
7
- const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
8
4
  const mobx_1 = require("mobx");
9
5
  const react_1 = require("react");
6
+ const shallowEqual_1 = require("../utils/shallowEqual");
10
7
  /** Evaluates a computed function `fn` to a regular value and triggers a re-render whenever it changes. */
11
8
  function useComputed(fn, deps) {
12
9
  // We always return the useRef value, and use this just to trigger re-renders
@@ -37,7 +34,11 @@ function useComputed(fn, deps) {
37
34
  // Only trigger a re-render if this is not the 1st autorun. Note
38
35
  // that if deps has changed, we're inherently in a re-render so also
39
36
  // don't need to trigger an additional re-render.
40
- if (oldHasRun && !(0, fast_deep_equal_1.default)(newValue, oldValue)) {
37
+ //
38
+ // Also, we avoid a deep equality, b/c if a `useComputed` is returning something
39
+ // complicated/cyclic, like ReactElement, deep equality will crawl into the guts
40
+ // of React/ReactFiber and cycle/infinite loop.
41
+ if (oldHasRun && !(0, shallowEqual_1.shallowEqual)(newValue, oldValue)) {
41
42
  setTick((tick) => tick + 1);
42
43
  }
43
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.308.1",
3
+ "version": "2.309.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -81,16 +81,16 @@
81
81
  "@homebound/tsconfig": "^1.0.3",
82
82
  "@semantic-release/exec": "^6.0.3",
83
83
  "@semantic-release/git": "^10.0.1",
84
- "@storybook/addon-docs": "^7.0.26",
85
- "@storybook/addon-essentials": "^7.0.26",
86
- "@storybook/addon-interactions": "^7.0.26",
87
- "@storybook/addon-links": "^7.0.26",
88
- "@storybook/addon-mdx-gfm": "^7.0.26",
89
- "@storybook/addons": "^7.0.26",
90
- "@storybook/manager-api": "^7.0.26",
91
- "@storybook/mdx2-csf": "1.1.0",
92
- "@storybook/react": "^7.0.26",
93
- "@storybook/react-vite": "^7.0.26",
84
+ "@storybook/addon-docs": "^7.3.0",
85
+ "@storybook/addon-essentials": "^7.3.0",
86
+ "@storybook/addon-interactions": "^7.3.0",
87
+ "@storybook/addon-links": "^7.3.0",
88
+ "@storybook/addon-mdx-gfm": "^7.3.0",
89
+ "@storybook/addons": "^7.3.0",
90
+ "@storybook/manager-api": "^7.3.0",
91
+ "@storybook/mdx2-csf": "^1.1.0",
92
+ "@storybook/react": "^7.3.0",
93
+ "@storybook/react-vite": "^7.3.0",
94
94
  "@storybook/testing-library": "^0.2.0",
95
95
  "@testing-library/jest-dom": "^5.16.5",
96
96
  "@tsconfig/recommended": "^1.0.2",
@@ -107,7 +107,7 @@
107
107
  "chromatic": "^6.17.0",
108
108
  "conventional-changelog-conventionalcommits": "^5.0.0",
109
109
  "eslint": "^8.12.0",
110
- "eslint-plugin-storybook": "^0.6.12",
110
+ "eslint-plugin-storybook": "^0.6.13",
111
111
  "husky": "^5.1.1",
112
112
  "identity-obj-proxy": "^3.0.0",
113
113
  "jest": "^29.4.3",
@@ -121,7 +121,7 @@
121
121
  "react": "^18.2.0",
122
122
  "react-dom": "^18.2.0",
123
123
  "semantic-release": "^20.1.0",
124
- "storybook": "^7.0.26",
124
+ "storybook": "^7.3.0",
125
125
  "storybook-addon-designs": "beta",
126
126
  "ts-jest": "^29.0.5",
127
127
  "ts-node": "^10.9.1",