fix: exempt scroll mark read after refresh - #4946
Conversation
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f41a4ee68f
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| }, [gracePeriodMs, refreshing]) | ||
|
|
||
| return isScrollMarkReadPaused |
There was a problem hiding this comment.
Return paused state immediately when refresh starts
useScrollMarkReadGracePeriod only flips isScrollMarkReadPaused inside a passive useEffect, so the first render where refreshing becomes true can still return false and allow scroll-based marking to run. In desktop flows (e.g. picture masonry observer callbacks), this creates a race at refresh start where freshly refreshed items can still be marked as read before the effect executes, which defeats the guard this change is adding.
Useful? React with 馃憤聽/ 馃憥.
| useEffect(() => { | ||
| processedEntryIds.current.clear() | ||
| }, [entriesIds]) |
There was a problem hiding this comment.
Clear processed entry IDs before range callbacks run
Switching processedEntryIds reset to useEffect leaves old IDs in place until after commit, but range updates can fire earlier via virtualization callbacks; the first callback after an entriesIds swap can therefore treat refreshed entries as already processed and skip batchMarkRead. This regression was introduced by moving from render-time reset (useMemo) to post-render reset (useEffect).
Useful? React with 馃憤聽/ 馃憥.
Description
Prevent freshly refreshed entries from being marked as read by the "When Scrolling Past Article" behavior on desktop and mobile.
Add a shared 1s grace period after list refresh and apply it only to scroll-based marking, while keeping render or in-view marking unchanged.
Cover the desktop list and picture masonry flows plus the mobile article, social, video, and picture lists.
PR Type
Screenshots (if UI change)
N/A
Demo Video (if new feature)
N/A
Linked Issues
N/A
Additional context
Validated with
pnpm run typecheck,pnpm run lint:fix, andpnpm run test.Changelog