@optilogic/core 1.3.1 → 1.3.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/dist/index.js CHANGED
@@ -4809,15 +4809,25 @@ function DataGrid({
4809
4809
  const [headerHeight, setHeaderHeight] = React20.useState(40);
4810
4810
  const [hoveredCell, setHoveredCell] = React20.useState(null);
4811
4811
  const [containerWidth, setContainerWidth] = React20.useState(0);
4812
- React20.useLayoutEffect(() => {
4813
- if (!fillWidth || !parentRef.current) return;
4814
- const observer = new ResizeObserver((entries) => {
4815
- const w = entries[0]?.contentRect.width;
4816
- if (w && w > 0) setContainerWidth(w);
4817
- });
4818
- observer.observe(parentRef.current);
4819
- return () => observer.disconnect();
4820
- }, [fillWidth]);
4812
+ const fillWidthObserverRef = React20.useRef(null);
4813
+ const parentCallbackRef = React20.useCallback(
4814
+ (node) => {
4815
+ fillWidthObserverRef.current?.disconnect();
4816
+ fillWidthObserverRef.current = null;
4817
+ parentRef.current = node;
4818
+ if (!fillWidth || !node) return;
4819
+ const observer = new ResizeObserver((entries) => {
4820
+ const w = entries[0]?.contentRect.width;
4821
+ if (w && w > 0) setContainerWidth(w);
4822
+ });
4823
+ observer.observe(node);
4824
+ fillWidthObserverRef.current = observer;
4825
+ },
4826
+ [fillWidth]
4827
+ );
4828
+ React20.useEffect(() => {
4829
+ return () => fillWidthObserverRef.current?.disconnect();
4830
+ }, []);
4821
4831
  const visibleColumns = React20.useMemo(
4822
4832
  () => columns.filter((col) => !col.hidden),
4823
4833
  [columns]
@@ -5120,7 +5130,7 @@ function DataGrid({
5120
5130
  /* @__PURE__ */ jsx(
5121
5131
  "div",
5122
5132
  {
5123
- ref: parentRef,
5133
+ ref: parentCallbackRef,
5124
5134
  className: "flex-1 overflow-auto bg-background relative w-full min-h-0 max-h-full",
5125
5135
  style: { contain: "strict" },
5126
5136
  children: /* @__PURE__ */ jsxs(
@@ -5335,7 +5345,7 @@ function DataGrid({
5335
5345
  }
5336
5346
  )
5337
5347
  ] }) }),
5338
- /* @__PURE__ */ jsxs("div", { ref: parentRef, className: "flex-1 overflow-auto min-h-0", children: [
5348
+ /* @__PURE__ */ jsxs("div", { ref: parentCallbackRef, className: "flex-1 overflow-auto min-h-0", children: [
5339
5349
  /* @__PURE__ */ jsx(
5340
5350
  "div",
5341
5351
  {