@legendapp/list 3.0.0-beta.47 → 3.0.0-beta.49

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/index.native.js CHANGED
@@ -855,6 +855,35 @@ var Container = typedMemo(function Container2({
855
855
  });
856
856
 
857
857
  // src/components/Containers.native.tsx
858
+ var ContainersLayer = typedMemo(function ContainersLayer2({ children, horizontal }) {
859
+ const ctx = useStateContext();
860
+ const columnWrapperStyle = ctx.columnWrapperStyle;
861
+ const animSize = useValue$("totalSize");
862
+ const otherAxisSize = useValue$("otherAxisSize");
863
+ const [readyToRender, numColumns] = useArr$(["readyToRender", "numColumns"]);
864
+ const style = horizontal ? { minHeight: otherAxisSize, opacity: readyToRender ? 1 : 0, width: animSize } : { height: animSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0 };
865
+ if (columnWrapperStyle) {
866
+ const { columnGap, rowGap, gap } = columnWrapperStyle;
867
+ const gapX = columnGap || gap || 0;
868
+ const gapY = rowGap || gap || 0;
869
+ if (horizontal) {
870
+ if (gapY && numColumns > 1) {
871
+ style.marginVertical = -gapY / 2;
872
+ }
873
+ if (gapX) {
874
+ style.marginRight = -gapX;
875
+ }
876
+ } else {
877
+ if (gapX && numColumns > 1) {
878
+ style.marginHorizontal = -gapX;
879
+ }
880
+ if (gapY) {
881
+ style.marginBottom = -gapY;
882
+ }
883
+ }
884
+ }
885
+ return /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { style }, children);
886
+ });
858
887
  var Containers = typedMemo(function Containers2({
859
888
  horizontal,
860
889
  recycleItems,
@@ -863,12 +892,7 @@ var Containers = typedMemo(function Containers2({
863
892
  updateItemSize: updateItemSize2,
864
893
  getRenderedItem: getRenderedItem2
865
894
  }) {
866
- const ctx = useStateContext();
867
- const columnWrapperStyle = ctx.columnWrapperStyle;
868
- const [numContainers, numColumns] = useArr$(["numContainersPooled", "numColumns"]);
869
- const animSize = useValue$("totalSize");
870
- const otherAxisSize = useValue$("otherAxisSize");
871
- const animOpacity = useValue$("readyToRender", { getValue: (value) => value ? 1 : 0 });
895
+ const [numContainers] = useArr$(["numContainersPooled"]);
872
896
  const containers = [];
873
897
  for (let i = 0; i < numContainers; i++) {
874
898
  containers.push(
@@ -887,28 +911,7 @@ var Containers = typedMemo(function Containers2({
887
911
  )
888
912
  );
889
913
  }
890
- const style = horizontal ? { minHeight: otherAxisSize, opacity: animOpacity, width: animSize } : { height: animSize, minWidth: otherAxisSize, opacity: animOpacity };
891
- if (columnWrapperStyle) {
892
- const { columnGap, rowGap, gap } = columnWrapperStyle;
893
- const gapX = columnGap || gap || 0;
894
- const gapY = rowGap || gap || 0;
895
- if (horizontal) {
896
- if (gapY && numColumns > 1) {
897
- style.marginVertical = -gapY / 2;
898
- }
899
- if (gapX) {
900
- style.marginRight = -gapX;
901
- }
902
- } else {
903
- if (gapX && numColumns > 1) {
904
- style.marginHorizontal = -gapX;
905
- }
906
- if (gapY) {
907
- style.marginBottom = -gapY;
908
- }
909
- }
910
- }
911
- return /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { style }, containers);
914
+ return /* @__PURE__ */ React2__namespace.createElement(ContainersLayer, { horizontal }, containers);
912
915
  });
913
916
  var ListComponentScrollView = ReactNative.Animated.ScrollView;
914
917
  function ScrollAdjust() {
@@ -1554,7 +1557,7 @@ function getId(state, index) {
1554
1557
  }
1555
1558
 
1556
1559
  // src/core/addTotalSize.ts
1557
- function addTotalSize(ctx, key, add) {
1560
+ function addTotalSize(ctx, key, add, notifyTotalSize = true) {
1558
1561
  const state = ctx.state;
1559
1562
  const prevTotalSize = state.totalSize;
1560
1563
  let totalSize = state.totalSize;
@@ -1573,25 +1576,29 @@ function addTotalSize(ctx, key, add) {
1573
1576
  } else {
1574
1577
  state.pendingTotalSize = void 0;
1575
1578
  state.totalSize = totalSize;
1576
- set$(ctx, "totalSize", totalSize);
1579
+ if (notifyTotalSize) {
1580
+ set$(ctx, "totalSize", totalSize);
1581
+ }
1577
1582
  }
1583
+ } else if (notifyTotalSize && ctx.values.get("totalSize") !== totalSize) {
1584
+ set$(ctx, "totalSize", totalSize);
1578
1585
  }
1579
1586
  }
1580
1587
 
1581
1588
  // src/core/setSize.ts
1582
- function setSize(ctx, itemKey, size) {
1589
+ function setSize(ctx, itemKey, size, notifyTotalSize = true) {
1583
1590
  const state = ctx.state;
1584
1591
  const { sizes } = state;
1585
1592
  const previousSize = sizes.get(itemKey);
1586
1593
  const diff = previousSize !== void 0 ? size - previousSize : size;
1587
1594
  if (diff !== 0) {
1588
- addTotalSize(ctx, itemKey, diff);
1595
+ addTotalSize(ctx, itemKey, diff, notifyTotalSize);
1589
1596
  }
1590
1597
  sizes.set(itemKey, size);
1591
1598
  }
1592
1599
 
1593
1600
  // src/utils/getItemSize.ts
1594
- function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize) {
1601
+ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, notifyTotalSize) {
1595
1602
  var _a3, _b, _c;
1596
1603
  const state = ctx.state;
1597
1604
  const {
@@ -1637,7 +1644,7 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize) {
1637
1644
  if (size === void 0) {
1638
1645
  size = getEstimatedItemSize ? getEstimatedItemSize(data, index, itemType) : estimatedItemSize;
1639
1646
  }
1640
- setSize(ctx, key, size);
1647
+ setSize(ctx, key, size, notifyTotalSize);
1641
1648
  return size;
1642
1649
  }
1643
1650
  function getItemSizeAtIndex(ctx, index) {
@@ -2160,10 +2167,10 @@ function getMountedBufferedIndices(state) {
2160
2167
  function getMountedNoBufferIndices(state) {
2161
2168
  return getMountedIndicesInRange(state, state.startNoBuffer, state.endNoBuffer);
2162
2169
  }
2163
- function checkAllSizesKnown(state, indices = getMountedBufferedIndices(state)) {
2170
+ function checkAllSizesKnown(state, indices) {
2164
2171
  return indices.length > 0 && indices.every((index) => {
2165
2172
  const key = getId(state, index);
2166
- return state.sizesKnown.has(key);
2173
+ return key !== void 0 && state.sizesKnown.has(key);
2167
2174
  });
2168
2175
  }
2169
2176
 
@@ -3382,6 +3389,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
3382
3389
  const maxVisibleArea = scrollBottomBuffered + 1e3;
3383
3390
  const useAverageSize = !getEstimatedItemSize;
3384
3391
  const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_b = peek$(ctx, "scrollAdjustPending")) != null ? _b : 0) !== 0;
3392
+ const notifyTotalSizeWhileCachingSizes = false;
3385
3393
  let currentRowTop = 0;
3386
3394
  let column = 1;
3387
3395
  let maxSizeInRow = 0;
@@ -3409,7 +3417,15 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
3409
3417
  const prevIndex = startIndex - 1;
3410
3418
  const prevId = getId(state, prevIndex);
3411
3419
  const prevPosition = (_c = positions[prevIndex]) != null ? _c : 0;
3412
- const prevSize = (_d = sizesKnown.get(prevId)) != null ? _d : getItemSize(ctx, prevId, prevIndex, data[prevIndex], useAverageSize, preferCachedSize);
3420
+ const prevSize = (_d = sizesKnown.get(prevId)) != null ? _d : getItemSize(
3421
+ ctx,
3422
+ prevId,
3423
+ prevIndex,
3424
+ data[prevIndex],
3425
+ useAverageSize,
3426
+ preferCachedSize,
3427
+ notifyTotalSizeWhileCachingSizes
3428
+ );
3413
3429
  currentRowTop = prevPosition + prevSize;
3414
3430
  }
3415
3431
  }
@@ -3442,7 +3458,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
3442
3458
  maxSizeInRow = 0;
3443
3459
  }
3444
3460
  const knownSize = sizesKnown.get(id);
3445
- const size = knownSize !== void 0 ? knownSize : getItemSize(ctx, id, i, data[i], useAverageSize, preferCachedSize);
3461
+ const size = knownSize !== void 0 ? knownSize : getItemSize(ctx, id, i, data[i], useAverageSize, preferCachedSize, notifyTotalSizeWhileCachingSizes);
3446
3462
  if (IS_DEV && needsIndexByKey) {
3447
3463
  if (indexByKeyForChecking.has(id)) {
3448
3464
  console.error(
@@ -3698,7 +3714,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
3698
3714
  }
3699
3715
  function checkIsViewable(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index) {
3700
3716
  let value = ctx.mapViewabilityAmountValues.get(containerId);
3701
- if (!value || value.key !== key) {
3717
+ if (!value || value.key !== key || value.index !== index) {
3702
3718
  value = computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index);
3703
3719
  }
3704
3720
  return value.isViewable;
@@ -3713,7 +3729,7 @@ var unstableBatchedUpdates = ReactNative__namespace.unstable_batchedUpdates;
3713
3729
  var batchedUpdates = typeof unstableBatchedUpdates === "function" ? unstableBatchedUpdates : (fn) => fn();
3714
3730
 
3715
3731
  // src/utils/findAvailableContainers.ts
3716
- function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers) {
3732
+ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers, protectedKeys) {
3717
3733
  const numContainers = peek$(ctx, "numContainers");
3718
3734
  const state = ctx.state;
3719
3735
  const { stickyContainerPool, containerItemTypes } = state;
@@ -3781,6 +3797,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
3781
3797
  }
3782
3798
  const key = peek$(ctx, `containerItemKey${u}`);
3783
3799
  if (key === void 0) continue;
3800
+ if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
3784
3801
  const index = state.indexByKey.get(key);
3785
3802
  const isOutOfView = index < startBuffered || index > endBuffered;
3786
3803
  if (isOutOfView) {
@@ -3916,7 +3933,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
3916
3933
  function calculateItemsInView(ctx, params = {}) {
3917
3934
  const state = ctx.state;
3918
3935
  batchedUpdates(() => {
3919
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
3936
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3920
3937
  const {
3921
3938
  columns,
3922
3939
  columnSpans,
@@ -4018,17 +4035,31 @@ function calculateItemsInView(ctx, params = {}) {
4018
4035
  if (minIndexSizeChanged !== void 0) {
4019
4036
  state.minIndexSizeChanged = void 0;
4020
4037
  }
4038
+ let protectedContainerKeys;
4039
+ if (dataChanged && doMVCP && state.props.maintainVisibleContentPosition.data && state.didContainersLayout && state.idsInView.length > 0) {
4040
+ const shouldRestorePosition = state.props.maintainVisibleContentPosition.shouldRestorePosition;
4041
+ protectedContainerKeys = /* @__PURE__ */ new Set();
4042
+ for (const id of state.idsInView) {
4043
+ const index = indexByKey.get(id);
4044
+ if (index === void 0) continue;
4045
+ if (shouldRestorePosition && !shouldRestorePosition(data[index], index, data)) continue;
4046
+ protectedContainerKeys.add(id);
4047
+ }
4048
+ }
4049
+ const scrollBeforeMVCP = state.scroll;
4050
+ const scrollAdjustPendingBeforeMVCP = (_e = peek$(ctx, "scrollAdjustPending")) != null ? _e : 0;
4021
4051
  checkMVCP == null ? void 0 : checkMVCP();
4052
+ const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0) !== scrollAdjustPendingBeforeMVCP);
4022
4053
  let startNoBuffer = null;
4023
4054
  let startBuffered = null;
4024
4055
  let startBufferedId = null;
4025
4056
  let endNoBuffer = null;
4026
4057
  let endBuffered = null;
4027
- let loopStart = (_e = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _e : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
4058
+ let loopStart = (_g = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _g : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
4028
4059
  for (let i = loopStart; i >= 0; i--) {
4029
- const id = (_f = idCache[i]) != null ? _f : getId(state, i);
4060
+ const id = (_h = idCache[i]) != null ? _h : getId(state, i);
4030
4061
  const top = positions[i];
4031
- const size = (_g = sizes.get(id)) != null ? _g : getItemSize(ctx, id, i, data[i]);
4062
+ const size = (_i = sizes.get(id)) != null ? _i : getItemSize(ctx, id, i, data[i]);
4032
4063
  const bottom = top + size;
4033
4064
  if (bottom > scroll - scrollBufferTop) {
4034
4065
  loopStart = i;
@@ -4059,8 +4090,8 @@ function calculateItemsInView(ctx, params = {}) {
4059
4090
  let firstFullyOnScreenIndex;
4060
4091
  const dataLength = data.length;
4061
4092
  for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
4062
- const id = (_h = idCache[i]) != null ? _h : getId(state, i);
4063
- const size = (_i = sizes.get(id)) != null ? _i : getItemSize(ctx, id, i, data[i]);
4093
+ const id = (_j = idCache[i]) != null ? _j : getId(state, i);
4094
+ const size = (_k = sizes.get(id)) != null ? _k : getItemSize(ctx, id, i, data[i]);
4064
4095
  const top = positions[i];
4065
4096
  if (!foundEnd) {
4066
4097
  if (startNoBuffer === null && top + size > scroll) {
@@ -4099,7 +4130,7 @@ function calculateItemsInView(ctx, params = {}) {
4099
4130
  const firstVisibleAnchorIndex = firstFullyOnScreenIndex != null ? firstFullyOnScreenIndex : startNoBuffer;
4100
4131
  if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && endNoBuffer !== null) {
4101
4132
  for (let i = firstVisibleAnchorIndex; i <= endNoBuffer; i++) {
4102
- const id = (_j = idCache[i]) != null ? _j : getId(state, i);
4133
+ const id = (_l = idCache[i]) != null ? _l : getId(state, i);
4103
4134
  idsInView.push(id);
4104
4135
  }
4105
4136
  }
@@ -4132,7 +4163,7 @@ function calculateItemsInView(ctx, params = {}) {
4132
4163
  const needNewContainers = [];
4133
4164
  const needNewContainersSet = /* @__PURE__ */ new Set();
4134
4165
  for (let i = startBuffered; i <= endBuffered; i++) {
4135
- const id = (_k = idCache[i]) != null ? _k : getId(state, i);
4166
+ const id = (_m = idCache[i]) != null ? _m : getId(state, i);
4136
4167
  if (!containerItemKeys.has(id)) {
4137
4168
  needNewContainersSet.add(i);
4138
4169
  needNewContainers.push(i);
@@ -4141,7 +4172,7 @@ function calculateItemsInView(ctx, params = {}) {
4141
4172
  if (alwaysRenderArr.length > 0) {
4142
4173
  for (const index of alwaysRenderArr) {
4143
4174
  if (index < 0 || index >= dataLength) continue;
4144
- const id = (_l = idCache[index]) != null ? _l : getId(state, index);
4175
+ const id = (_n = idCache[index]) != null ? _n : getId(state, index);
4145
4176
  if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
4146
4177
  needNewContainersSet.add(index);
4147
4178
  needNewContainers.push(index);
@@ -4174,12 +4205,13 @@ function calculateItemsInView(ctx, params = {}) {
4174
4205
  endBuffered,
4175
4206
  pendingRemoval,
4176
4207
  requiredItemTypes,
4177
- needNewContainers
4208
+ needNewContainers,
4209
+ protectedContainerKeys
4178
4210
  );
4179
4211
  for (let idx = 0; idx < needNewContainers.length; idx++) {
4180
4212
  const i = needNewContainers[idx];
4181
4213
  const containerIndex = availableContainers[idx];
4182
- const id = (_m = idCache[i]) != null ? _m : getId(state, i);
4214
+ const id = (_o = idCache[i]) != null ? _o : getId(state, i);
4183
4215
  const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
4184
4216
  if (oldKey && oldKey !== id) {
4185
4217
  containerItemKeys.delete(oldKey);
@@ -4190,6 +4222,7 @@ function calculateItemsInView(ctx, params = {}) {
4190
4222
  state.containerItemTypes.set(containerIndex, requiredItemTypes[idx]);
4191
4223
  }
4192
4224
  containerItemKeys.set(id, containerIndex);
4225
+ (_p = state.userScrollAnchorResetKeys) == null ? void 0 : _p.add(id);
4193
4226
  const containerSticky = `containerSticky${containerIndex}`;
4194
4227
  const isSticky = stickyIndicesSet.has(i);
4195
4228
  const isAlwaysRender = alwaysRenderSet.has(i);
@@ -4217,10 +4250,13 @@ function calculateItemsInView(ctx, params = {}) {
4217
4250
  }
4218
4251
  }
4219
4252
  }
4253
+ if (((_q = state.userScrollAnchorResetKeys) == null ? void 0 : _q.size) === 0) {
4254
+ state.userScrollAnchorResetKeys = void 0;
4255
+ }
4220
4256
  if (alwaysRenderArr.length > 0) {
4221
4257
  for (const index of alwaysRenderArr) {
4222
4258
  if (index < 0 || index >= dataLength) continue;
4223
- const id = (_n = idCache[index]) != null ? _n : getId(state, index);
4259
+ const id = (_r = idCache[index]) != null ? _r : getId(state, index);
4224
4260
  const containerIndex = containerItemKeys.get(id);
4225
4261
  if (containerIndex !== void 0) {
4226
4262
  state.stickyContainerPool.add(containerIndex);
@@ -4281,16 +4317,18 @@ function calculateItemsInView(ctx, params = {}) {
4281
4317
  handleInitialScrollLayoutReady(ctx);
4282
4318
  }
4283
4319
  if (viewabilityConfigCallbackPairs && startNoBuffer !== null && endNoBuffer !== null) {
4284
- updateViewableItems(
4285
- ctx.state,
4286
- ctx,
4287
- viewabilityConfigCallbackPairs,
4288
- scrollLength,
4289
- startNoBuffer,
4290
- endNoBuffer,
4291
- startBuffered != null ? startBuffered : startNoBuffer,
4292
- endBuffered != null ? endBuffered : endNoBuffer
4293
- );
4320
+ if (!didMVCPAdjustScroll) {
4321
+ updateViewableItems(
4322
+ ctx.state,
4323
+ ctx,
4324
+ viewabilityConfigCallbackPairs,
4325
+ scrollLength,
4326
+ startNoBuffer,
4327
+ endNoBuffer,
4328
+ startBuffered != null ? startBuffered : startNoBuffer,
4329
+ endBuffered != null ? endBuffered : endNoBuffer
4330
+ );
4331
+ }
4294
4332
  }
4295
4333
  if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
4296
4334
  const item = data[nextActiveStickyIndex];
@@ -4580,7 +4618,14 @@ function updateScroll(ctx, newScroll, forceUpdate) {
4580
4618
  (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state, { doMVCP: scrollingTo !== void 0 });
4581
4619
  checkThresholds(ctx);
4582
4620
  };
4583
- if (Platform.OS === "web" && scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength) {
4621
+ if (scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength && !state.pendingNativeMVCPAdjust) {
4622
+ state.mvcpAnchorLock = void 0;
4623
+ state.pendingNativeMVCPAdjust = void 0;
4624
+ state.userScrollAnchorResetKeys = /* @__PURE__ */ new Set();
4625
+ if (state.queuedMVCPRecalculate !== void 0) {
4626
+ cancelAnimationFrame(state.queuedMVCPRecalculate);
4627
+ state.queuedMVCPRecalculate = void 0;
4628
+ }
4584
4629
  flushSync(runCalculateItems);
4585
4630
  } else {
4586
4631
  runCalculateItems();
@@ -4763,6 +4808,20 @@ function maybeUpdateAnchoredEndSpace(ctx) {
4763
4808
  // src/core/updateItemSize.ts
4764
4809
  function runOrScheduleMVCPRecalculate(ctx) {
4765
4810
  const state = ctx.state;
4811
+ if (state.userScrollAnchorResetKeys !== void 0) {
4812
+ if (state.queuedMVCPRecalculate !== void 0) {
4813
+ return;
4814
+ }
4815
+ state.queuedMVCPRecalculate = requestAnimationFrame(() => {
4816
+ var _a3;
4817
+ state.queuedMVCPRecalculate = void 0;
4818
+ calculateItemsInView(ctx);
4819
+ if (((_a3 = state.userScrollAnchorResetKeys) == null ? void 0 : _a3.size) === 0) {
4820
+ state.userScrollAnchorResetKeys = void 0;
4821
+ }
4822
+ });
4823
+ return;
4824
+ }
4766
4825
  if (Platform.OS === "web") {
4767
4826
  if (!state.mvcpAnchorLock) {
4768
4827
  if (state.queuedMVCPRecalculate !== void 0) {
@@ -4786,6 +4845,8 @@ function runOrScheduleMVCPRecalculate(ctx) {
4786
4845
  function updateItemSize(ctx, itemKey, sizeObj) {
4787
4846
  var _a3;
4788
4847
  const state = ctx.state;
4848
+ const userScrollAnchorResetKeys = state.userScrollAnchorResetKeys;
4849
+ const didMeasureUserScrollAnchorResetItem = !!(userScrollAnchorResetKeys == null ? void 0 : userScrollAnchorResetKeys.delete(itemKey));
4789
4850
  const {
4790
4851
  didContainersLayout,
4791
4852
  sizesKnown,
@@ -4864,10 +4925,12 @@ function updateItemSize(ctx, itemKey, sizeObj) {
4864
4925
  if (!cur || maxOtherAxisSize > cur) {
4865
4926
  set$(ctx, "otherAxisSize", maxOtherAxisSize);
4866
4927
  }
4867
- if (didContainersLayout || checkAllSizesKnown(state)) {
4928
+ if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
4868
4929
  if (needsRecalculate) {
4869
4930
  state.scrollForNextCalculateItemsInView = void 0;
4870
4931
  runOrScheduleMVCPRecalculate(ctx);
4932
+ } else if (didMeasureUserScrollAnchorResetItem && (userScrollAnchorResetKeys == null ? void 0 : userScrollAnchorResetKeys.size) === 0) {
4933
+ state.userScrollAnchorResetKeys = void 0;
4871
4934
  }
4872
4935
  if (shouldMaintainScrollAtEnd) {
4873
4936
  if (maintainScrollAtEnd == null ? void 0 : maintainScrollAtEnd.onItemLayout) {