Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,17 @@
const changedRecord = heights.getRecord();
if (changedRecord.size === 1) {
const recordKey = Array.from(changedRecord)[0];
const startIndexKey = getKey(mergedData[start]);
if (startIndexKey === recordKey) {
const realStartHeight = heights.get(recordKey);
const diffHeight = realStartHeight - itemHeight;
syncScrollTop((ori) => {
return ori + diffHeight;
});
// Quick switch data may cause `start` not in `mergedData` anymore
const startItem = mergedData[start];

Check warning on line 283 in src/List.tsx

View check run for this annotation

Codecov / codecov/patch

src/List.tsx#L283

Added line #L283 was not covered by tests
if (startItem) {
const startIndexKey = getKey(startItem);

Check warning on line 285 in src/List.tsx

View check run for this annotation

Codecov / codecov/patch

src/List.tsx#L285

Added line #L285 was not covered by tests
if (startIndexKey === recordKey) {
const realStartHeight = heights.get(recordKey);
const diffHeight = realStartHeight - itemHeight;
syncScrollTop((ori) => {
return ori + diffHeight;

Check warning on line 290 in src/List.tsx

View check run for this annotation

Codecov / codecov/patch

src/List.tsx#L287-L290

Added lines #L287 - L290 were not covered by tests
});
}
}
}

Expand Down
Loading