@legendapp/list 1.0.0-beta.7 → 1.0.0-beta.8

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.
Files changed (3) hide show
  1. package/index.js +4 -8
  2. package/index.mjs +4 -8
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1341,22 +1341,18 @@ var LegendListInner = React5.forwardRef(function LegendListInner2(props, forward
1341
1341
  calculateItemsInView(state.scrollVelocity);
1342
1342
  });
1343
1343
  const updateItemSize = React5.useCallback((containerId, itemKey, size) => {
1344
- var _a2;
1345
- const data2 = (_a2 = refState.current) == null ? void 0 : _a2.data;
1344
+ const state = refState.current;
1345
+ const { sizes, indexByKey, columns, sizesLaidOut, data: data2 } = state;
1346
1346
  if (!data2) {
1347
1347
  return;
1348
1348
  }
1349
- const state = refState.current;
1350
- const { sizes, indexByKey, columns, sizesLaidOut } = state;
1351
1349
  const index = indexByKey.get(itemKey);
1352
1350
  const numColumns = peek$(ctx, "numColumns");
1353
1351
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, index) : index;
1354
- const row = Math.floor(index / numColumns);
1355
- const prevSize = getRowHeight(row);
1352
+ const prevSize = getItemSize(itemKey, index, data2);
1356
1353
  if (!prevSize || Math.abs(prevSize - size) > 0.5) {
1357
1354
  let diff;
1358
1355
  if (numColumns > 1) {
1359
- const prevMaxSizeInRow = getRowHeight(row);
1360
1356
  sizes.set(itemKey, size);
1361
1357
  const column = columns.get(itemKey);
1362
1358
  const loopStart = index - (column - 1);
@@ -1366,7 +1362,7 @@ var LegendListInner = React5.forwardRef(function LegendListInner2(props, forward
1366
1362
  const size2 = getItemSize(id, i, data2[i]);
1367
1363
  nextMaxSizeInRow = Math.max(nextMaxSizeInRow, size2);
1368
1364
  }
1369
- diff = nextMaxSizeInRow - prevMaxSizeInRow;
1365
+ diff = nextMaxSizeInRow - prevSize;
1370
1366
  } else {
1371
1367
  sizes.set(itemKey, size);
1372
1368
  diff = size - prevSize;
package/index.mjs CHANGED
@@ -1320,22 +1320,18 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
1320
1320
  calculateItemsInView(state.scrollVelocity);
1321
1321
  });
1322
1322
  const updateItemSize = useCallback((containerId, itemKey, size) => {
1323
- var _a2;
1324
- const data2 = (_a2 = refState.current) == null ? void 0 : _a2.data;
1323
+ const state = refState.current;
1324
+ const { sizes, indexByKey, columns, sizesLaidOut, data: data2 } = state;
1325
1325
  if (!data2) {
1326
1326
  return;
1327
1327
  }
1328
- const state = refState.current;
1329
- const { sizes, indexByKey, columns, sizesLaidOut } = state;
1330
1328
  const index = indexByKey.get(itemKey);
1331
1329
  const numColumns = peek$(ctx, "numColumns");
1332
1330
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, index) : index;
1333
- const row = Math.floor(index / numColumns);
1334
- const prevSize = getRowHeight(row);
1331
+ const prevSize = getItemSize(itemKey, index, data2);
1335
1332
  if (!prevSize || Math.abs(prevSize - size) > 0.5) {
1336
1333
  let diff;
1337
1334
  if (numColumns > 1) {
1338
- const prevMaxSizeInRow = getRowHeight(row);
1339
1335
  sizes.set(itemKey, size);
1340
1336
  const column = columns.get(itemKey);
1341
1337
  const loopStart = index - (column - 1);
@@ -1345,7 +1341,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
1345
1341
  const size2 = getItemSize(id, i, data2[i]);
1346
1342
  nextMaxSizeInRow = Math.max(nextMaxSizeInRow, size2);
1347
1343
  }
1348
- diff = nextMaxSizeInRow - prevMaxSizeInRow;
1344
+ diff = nextMaxSizeInRow - prevSize;
1349
1345
  } else {
1350
1346
  sizes.set(itemKey, size);
1351
1347
  diff = size - prevSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "legend-list",
5
5
  "sideEffects": false,
6
6
  "private": false,