Skip to content

Commit cd576ff

Browse files
authored
fix(mobile): no marking read when no scrolling (#2913)
1 parent 34540a1 commit cd576ff

File tree

1 file changed

+5
-3
lines changed
  • apps/mobile/src/modules/entry-list

1 file changed

+5
-3
lines changed

apps/mobile/src/modules/entry-list/hooks.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function useOnViewableItemsChanged({
1212
}: {
1313
idExtractor?: (item: ViewToken) => string
1414
} = {}) {
15-
const orientation = useRef<"down" | "up">("down")
15+
const orientation = useRef<"down" | "up" | "initial">("initial")
1616
const lastOffset = useRef(0)
1717

1818
const markAsReadWhenScrolling = useGeneralSettingKey("scrollMarkUnread")
@@ -26,15 +26,17 @@ export function useOnViewableItemsChanged({
2626
}) => void = useNonReactiveCallback(({ viewableItems, changed }) => {
2727
debouncedFetchEntryContentByStream(viewableItems.map((item) => stableIdExtractor(item)))
2828

29-
if (markAsReadWhenScrolling && orientation.current === "down") {
29+
if (orientation.current !== "down") return
30+
31+
if (markAsReadWhenScrolling) {
3032
changed
3133
.filter((item) => !item.isViewable)
3234
.forEach((item) => {
3335
unreadSyncService.markEntryAsRead(stableIdExtractor(item))
3436
})
3537
}
3638

37-
if (markAsReadWhenRendering && orientation.current === "down") {
39+
if (markAsReadWhenRendering) {
3840
viewableItems.forEach((item) => {
3941
unreadSyncService.markEntryAsRead(stableIdExtractor(item))
4042
})

0 commit comments

Comments
 (0)