twico-ui 1.22.2 → 1.22.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
4
4
 
5
+ ## [1.22.3](https://github.com/EncryptionL/twico-ui/compare/v1.22.2...v1.22.3) (2026-07-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **datatable:** stop stateKey persistence being clobbered under Strict Mode + async columns ([#298](https://github.com/EncryptionL/twico-ui/issues/298)) ([d7ff41e](https://github.com/EncryptionL/twico-ui/commit/d7ff41e2bd9f3e1d20d31eaf2b6ca0ae2348c6ab))
11
+
5
12
  ## [1.22.2](https://github.com/EncryptionL/twico-ui/compare/v1.22.1...v1.22.2) (2026-07-29)
6
13
 
7
14
 
package/dist/index.cjs CHANGED
@@ -9361,6 +9361,7 @@ function Datatable({
9361
9361
  }
9362
9362
  };
9363
9363
  const stateReadyRef = React51__namespace.default.useRef(false);
9364
+ const stateRestoredRef = React51__namespace.default.useRef(false);
9364
9365
  const onStateChangeRef = React51__namespace.default.useRef(onStateChange);
9365
9366
  onStateChangeRef.current = onStateChange;
9366
9367
  React51__namespace.default.useEffect(() => {
@@ -9376,7 +9377,7 @@ function Datatable({
9376
9377
  }
9377
9378
  return void 0;
9378
9379
  }, [filters, sort, quick, pageVal, sizeVal, order, widths, hidden, pins, density, fWidths, fPanelSize, stateKey]);
9379
- React51__namespace.default.useEffect(() => {
9380
+ const restoreState = () => {
9380
9381
  let saved = null;
9381
9382
  if (stateKey) {
9382
9383
  try {
@@ -9387,8 +9388,22 @@ function Datatable({
9387
9388
  }
9388
9389
  if (!saved && initialState) saved = initialState;
9389
9390
  if (saved) applyState(saved);
9390
- stateReadyRef.current = true;
9391
+ stateRestoredRef.current = true;
9392
+ };
9393
+ React51__namespace.default.useEffect(() => {
9394
+ if (columns.length) {
9395
+ restoreState();
9396
+ stateReadyRef.current = true;
9397
+ }
9398
+ return () => {
9399
+ stateReadyRef.current = false;
9400
+ };
9391
9401
  }, []);
9402
+ React51__namespace.default.useEffect(() => {
9403
+ if (stateRestoredRef.current || !columns.length) return;
9404
+ restoreState();
9405
+ stateReadyRef.current = true;
9406
+ }, [columns.length]);
9392
9407
  const rootRef = React51__namespace.default.useRef(null);
9393
9408
  const [compact, setCompact] = React51__namespace.default.useState(false);
9394
9409
  React51__namespace.default.useEffect(() => {
@@ -9461,20 +9476,19 @@ function Datatable({
9461
9476
  React51__namespace.default.useEffect(() => {
9462
9477
  setOrder((prev) => mergeColOrder(prev, columns.map((c) => c.field).filter(Boolean)));
9463
9478
  }, [columns]);
9464
- const densitySyncedRef = React51__namespace.default.useRef(false);
9479
+ const densityPropRef = React51__namespace.default.useRef(densityProp);
9465
9480
  React51__namespace.default.useEffect(() => {
9466
- if (densitySyncedRef.current) setDensity(densityProp);
9467
- else densitySyncedRef.current = true;
9481
+ if (densityPropRef.current === densityProp) return;
9482
+ densityPropRef.current = densityProp;
9483
+ setDensity(densityProp);
9468
9484
  }, [densityProp]);
9469
9485
  React51__namespace.default.useEffect(() => {
9470
9486
  setAggOn(showAggregation);
9471
9487
  }, [showAggregation]);
9472
- const pageSizeSyncedRef = React51__namespace.default.useRef(false);
9488
+ const pageSizePropRef = React51__namespace.default.useRef(pageSize);
9473
9489
  React51__namespace.default.useEffect(() => {
9474
- if (!pageSizeSyncedRef.current) {
9475
- pageSizeSyncedRef.current = true;
9476
- return;
9477
- }
9490
+ if (pageSizePropRef.current === pageSize) return;
9491
+ pageSizePropRef.current = pageSize;
9478
9492
  if (pageSizeControlled) return;
9479
9493
  setInternalRpp(pageSize > 0 ? pageSize : 10);
9480
9494
  setInternalPage(0);