fix(mobile): prevent incorrect read marking during pull-to-refresh

The entry list was incorrectly marking entries as read during pull-to-refresh
operations. This happened because when the refresh control rebounds from
negative contentOffset back to 0, the scroll direction is detected as "down"
causing entries to be mistakenly marked as read.

The fix adds a condition to only mark entries as read when:
1. Scroll direction is down (user swiping up)
2. Current offset is greater than 0 (not at the top or rebounding)

This ensures entries are only marked as read during genuine upward scrolling,
not during pull-to-refresh rebounds.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DIYgod 2025-07-14 19:37:00 +08:00
parent 4ebff4d35d
commit e7c8380647
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@ export function useOnViewableItemsChanged({
)
const removed = changed.filter((item) => !item.isViewable)
if (orientation.current === "down") {
// Only when the scroll direction is down and the current offset is a positive number, is it marked as read.
// This can avoid misjudgment during the rebound of the pull-to-refresh (because the offset will change from negative to zero during the rebound).
if (orientation.current === "down" && lastOffset.current > 0) {
setLastViewableItems(viewableItems)
if (removed.length > 0) {
setLastRemovedItems((prev) => {