@gridkitjs/react 0.0.0-dev-20261109134250 → 0.0.0-dev-20261111180407

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
@@ -4437,7 +4437,10 @@ function useLiveAnnouncer(containerRef) {
4437
4437
 
4438
4438
  // src/DataGrid/useRowVirtualizer.ts
4439
4439
  import { useLayoutEffect as useLayoutEffect16, useRef as useRef22, useState as useState17 } from "react";
4440
- import { createRowVirtualizer as createRowVirtualizer2 } from "@gridkitjs/dom";
4440
+ import {
4441
+ bodyRowFrom as bodyRowFrom3,
4442
+ createRowVirtualizer as createRowVirtualizer2
4443
+ } from "@gridkitjs/dom";
4441
4444
  var ALL_ROWS = { kind: "allRows" };
4442
4445
  var NO_ROWS3 = {
4443
4446
  kind: "range",
@@ -4454,6 +4457,14 @@ function rangeOf(rowWindow, rowCount) {
4454
4457
  offsetAfter: 0
4455
4458
  };
4456
4459
  }
4460
+ function* mountedRows(table) {
4461
+ for (const row of table?.tBodies[0]?.rows ?? []) {
4462
+ const target = bodyRowFrom3(row);
4463
+ if (target !== null) {
4464
+ yield [target.rowIndex, row];
4465
+ }
4466
+ }
4467
+ }
4457
4468
  function ignoreRow() {
4458
4469
  return () => void 0;
4459
4470
  }
@@ -4461,6 +4472,7 @@ function useRowVirtualizer({
4461
4472
  enabled,
4462
4473
  rows,
4463
4474
  bodyScrollRef,
4475
+ bodyTableRef,
4464
4476
  estimatedRowHeight,
4465
4477
  overscan
4466
4478
  }) {
@@ -4489,12 +4501,13 @@ function useRowVirtualizer({
4489
4501
  }
4490
4502
  });
4491
4503
  created.setRowCount(rowCount.current);
4504
+ created.measureRows(mountedRows(bodyTableRef.current));
4492
4505
  instance.current = created;
4493
4506
  setVirtualizer(created);
4494
4507
  return () => {
4495
4508
  created.destroy();
4496
4509
  };
4497
- }, [enabled, bodyScrollRef, estimatedRowHeight, overscan]);
4510
+ }, [enabled, bodyScrollRef, bodyTableRef, estimatedRowHeight, overscan]);
4498
4511
  const range = rangeOf(rowWindow, rows.length);
4499
4512
  return {
4500
4513
  startIndex: range.startIndex,
@@ -4611,6 +4624,7 @@ function DataGrid(props) {
4611
4624
  enabled: virtualized,
4612
4625
  rows: view.pageRows,
4613
4626
  bodyScrollRef,
4627
+ bodyTableRef,
4614
4628
  estimatedRowHeight,
4615
4629
  overscan
4616
4630
  });