virtua 0.41.1 → 0.41.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.
@@ -1357,11 +1357,6 @@ const Virtualizer = (props) => {
1357
1357
  scroller.$dispose();
1358
1358
  });
1359
1359
  });
1360
- createComputed(on(() => props.data.length, (count) => {
1361
- if (count !== store.$getItemsLength()) {
1362
- store.$update(ACTION_ITEMS_LENGTH_CHANGE, [count, props.shift]);
1363
- }
1364
- }));
1365
1360
  createComputed(on(() => props.startMargin || 0, (value) => {
1366
1361
  if (value !== store.$getStartSpacerSize()) {
1367
1362
  store.$update(ACTION_START_OFFSET_CHANGE, value);
@@ -1371,6 +1366,12 @@ const Virtualizer = (props) => {
1371
1366
  scroller.$fixScrollJump();
1372
1367
  }));
1373
1368
  const dataSlice = createMemo(() => {
1369
+ const count = props.data.length;
1370
+ untrack(() => {
1371
+ if (count !== store.$getItemsLength()) {
1372
+ store.$update(ACTION_ITEMS_LENGTH_CHANGE, [count, props.shift]);
1373
+ }
1374
+ });
1374
1375
  const [start, end] = range();
1375
1376
  const items = end >= 0 ? props.data.slice(start, end + 1) : [];
1376
1377
  const indexes = items.map((_, index) => start + index);
@@ -1527,15 +1528,16 @@ const WindowVirtualizer = (props) => {
1527
1528
  scroller.$dispose();
1528
1529
  });
1529
1530
  });
1530
- createComputed(on(() => props.data.length, (len) => {
1531
- if (len !== store.$getItemsLength()) {
1532
- store.$update(ACTION_ITEMS_LENGTH_CHANGE, [len, props.shift]);
1533
- }
1534
- }));
1535
1531
  createEffect(on(stateVersion, () => {
1536
1532
  scroller.$fixScrollJump();
1537
1533
  }));
1538
1534
  const dataSlice = createMemo(() => {
1535
+ const count = props.data.length;
1536
+ untrack(() => {
1537
+ if (count !== store.$getItemsLength()) {
1538
+ store.$update(ACTION_ITEMS_LENGTH_CHANGE, [count, props.shift]);
1539
+ }
1540
+ });
1539
1541
  const [start, end] = range();
1540
1542
  return end >= 0 ? props.data.slice(start, end + 1) : [];
1541
1543
  });