najm-kit 2.2.0 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.1
4
+
5
+ - Fixed a regression in 2.2.0: the dynamic page size reported under `manualPagination` could oscillate. Card row height is measured from rendered cards, so it grows as images decode; feeding that back into the page size refetched, re-rendered, re-measured, and refetched again. A list visibly settled from one page size to another with the loading skeleton flashing twice. The report is now allowed once per container geometry, which does not depend on the rows inside it, so it terminates. A resize still re-arms it, and the debounce still waits for the measurement to settle before reporting.
6
+
3
7
  ## 2.2.0
4
8
 
5
9
  - Added `cardPagination` mode `infinite`: card lists continue on scroll instead of behind a button. No control and no end-of-list element render while the list is healthy. The continuation button appears only after an append failure, as the retry target.
package/dist/index.mjs CHANGED
@@ -12566,6 +12566,7 @@ function useTable(effectiveViewModeOverride) {
12566
12566
  const calculatedPageSize = useTableStore.use.calculatedPageSize();
12567
12567
  const calculatedCardPageSize = useTableStore.use.calculatedCardPageSize();
12568
12568
  const measuredBodyHeight = useTableStore.use.bodyHeight();
12569
+ const measuredBodyWidth = useTableStore.use.bodyWidth();
12569
12570
  const syncWithProps = useTableStore.use.syncWithProps();
12570
12571
  const onStateChange = useTableStore.use.onStateChange();
12571
12572
  const getRowId = useTableStore.use.getRowId();
@@ -12693,16 +12694,17 @@ function useTable(effectiveViewModeOverride) {
12693
12694
  }
12694
12695
  }, [calculatedPageSize, dynamicHeight, renderedMode, viewMode, cardPagination.mode, table, data.length, manualPagination]);
12695
12696
  const dynamicPageSizeTarget = renderedMode === "cards" ? calculatedCardPageSize : calculatedPageSize;
12696
- const lastRequestedDynamicSizeRef = useRef(null);
12697
+ const geometryKey = `${renderedMode}:${measuredBodyWidth}x${measuredBodyHeight}`;
12698
+ const reportedGeometryRef = useRef(null);
12697
12699
  useEffect(() => {
12698
12700
  if (!manualPagination || !dynamicHeight) return;
12699
12701
  if (cardPagination.mode !== "paged") return;
12700
12702
  if (measuredBodyHeight <= 0) return;
12701
12703
  if (!dynamicPageSizeTarget || dynamicPageSizeTarget < 1) return;
12702
12704
  if (dynamicPageSizeTarget === storePagination.pageSize) return;
12703
- if (lastRequestedDynamicSizeRef.current === dynamicPageSizeTarget) return;
12705
+ if (reportedGeometryRef.current === geometryKey) return;
12704
12706
  const timer = setTimeout(() => {
12705
- lastRequestedDynamicSizeRef.current = dynamicPageSizeTarget;
12707
+ reportedGeometryRef.current = geometryKey;
12706
12708
  setPagination({ pageIndex: storePagination.pageIndex, pageSize: dynamicPageSizeTarget });
12707
12709
  }, DYNAMIC_PAGE_SIZE_DEBOUNCE_MS);
12708
12710
  return () => clearTimeout(timer);
@@ -12711,6 +12713,7 @@ function useTable(effectiveViewModeOverride) {
12711
12713
  dynamicHeight,
12712
12714
  cardPagination.mode,
12713
12715
  measuredBodyHeight,
12716
+ geometryKey,
12714
12717
  dynamicPageSizeTarget,
12715
12718
  storePagination.pageIndex,
12716
12719
  storePagination.pageSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Reusable React UI component package for Najm framework",