Skip to content

Commit

Permalink
fix: hydrateSpaceStateToken with null itemMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuever committed Apr 24, 2023
1 parent 0b89a3d commit 385af07
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions packages/data-model/src/ListDimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,12 @@ class ListDimensions<ItemT extends {} = {}> extends BaseDimensions {
position: SpaceStateTokenPosition
) {
const itemMeta = this.getItemMeta(item, index);
const currentIndex = itemMeta?.getIndexInfo().index || -1;
if (!itemMeta) return;
const currentIndex = itemMeta.getIndexInfo().index;
const lastTokenIndex = spaceStateResult.length - 1;
const lastToken = spaceStateResult[lastTokenIndex];
const itemKey = itemMeta.getKey();
const itemLayout = itemMeta?.getLayout();
const itemLayout = itemMeta.getLayout();
const isSticky = this.stickyHeaderIndices.indexOf(index) !== -1;
const isSpace =
!isSticky &&
Expand Down Expand Up @@ -1040,47 +1041,7 @@ class ListDimensions<ItemT extends {} = {}> extends BaseDimensions {
position: 'buffered',
});
} else {
// if (recycleEnabled) {
// if (visibleStartIndex > 0) {
// spaceStateResult.push({
// key: 'spacer_before',
// length: this.getIndexKeyOffset(visibleStartIndex, true),
// isSpace: true,
// isSticky: false,
// item: null,
// position: 'buffered',
// });
// }

// for (let index = visibleStartIndex; index <= visibleEndIndex; index++) {
// const item = data[index];
// if (item)
// this.hydrateSpaceStateToken(
// spaceStateResult,
// item,
// index,
// 'buffered'
// );
// }

// if (
// visibleEndIndex < data.length - 1 &&
// typeof this.getTotalLength() === 'number'
// ) {
// spaceStateResult.push({
// key: 'spacer_after',
// length:
// (this.getTotalLength() as number) -
// this.getIndexKeyOffset(visibleEndIndex + 1, true),
// isSpace: true,
// isSticky: false,
// item: null,
// position: 'buffered',
// });
// }
// } else {
spaceStateResult = this.resolveSpaceState(state);
// }
}

const stateResult = {
Expand Down

0 comments on commit 385af07

Please sign in to comment.