Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

virtual-core: a clamp retry can overwrite a scroll command and ignores _canWriteScroll()

Đang mở
#1,327 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend, performance

Hướng nghiên cứu

Start in the virtual-core scroll write path: _retryClampedAdjustment, _canWriteScroll, _startScroll, _writeAwaitingCommand, and the _willUpdate and resizeItem calls that grow the sizer. Reproduce the case where a clamped retry at { target: 4850, maxAtWrite: 4800 } fires after a scrollToIndex write to 550. Done when a command's target is never overwritten by a retry, the retry respects _canWriteScroll(), and tests cover desktop and the iOS 27 tail timer.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

_retryClampedAdjustment repeats a compensation write that the browser clamped because the sizer was not big enough yet (#1258). It has two problems.

1. The retry can overwrite a scroll command
  1. A hold flush or a compensation write is clamped. The virtualizer records a retry, for example { target: 4850, maxAtWrite: 4800 }.
  2. A scroll command writes. For example, scrollToIndex writes 550.
  3. _willUpdate or resizeItem runs before the command's read-back. The sizer is now bigger, so the retry writes 4850.

The scroll position is 4850, not the target of the command.

  • This occurs on desktop and on iOS.
  • On iOS 27 it occurs more often. The tail timer flushes the hold and then writes a queued command in the same task.
  • It occurs only with adapters whose notify does not grow the sizer synchronously. The React adapter grows it synchronously.
  • #1324 fixed this for a queued command: _writeAwaitingCommand clears the retry. Other commands still have the problem.
2. The retry ignores _canWriteScroll()

The retry can write during the iOS touch tail or under a finger that drags. iOS ignores a write under a finger. On iOS 26 and earlier, a write during the tail stops the momentum.

Possible fix

  • Clear _clampedAdjustment when a command starts (_startScroll), or skip the retry while scrollState !== null.
  • In _retryClampedAdjustment, return early when _canWriteScroll() is false. Keep the record for the next opportunity.
  • Add tests for desktop and for the iOS 27 tail timer.

Found during the review of #1324. Related: #1258, #1307.

Ngôn ngữ chính
TypeScript
Star
7.1k
Fork
472
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
31

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/virtual

Tất cả issue của TanStack/virtual

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.