@@ -2,15 +2,19 @@ import type { FeedViewType } from "@follow/constants"
2
2
import { useInfiniteQuery , useMutation , useQuery } from "@tanstack/react-query"
3
3
import { useCallback , useEffect } from "react"
4
4
5
+ import { useGeneralSettingKey } from "@/src/atoms/settings/general"
6
+
5
7
import { getEntry } from "./getter"
6
8
import { entrySyncServices , useEntryStore } from "./store"
7
9
import type { EntryModel , FetchEntriesProps } from "./types"
8
10
9
- export const usePrefetchEntries = ( props : Omit < FetchEntriesProps , "pageParam" > | null ) => {
10
- const { feedId, inboxId, listId, view, read, limit } = props || { }
11
+ export const usePrefetchEntries = ( props : Omit < FetchEntriesProps , "pageParam" | "read" > | null ) => {
12
+ const { feedId, inboxId, listId, view, limit } = props || { }
13
+ const unreadOnly = useGeneralSettingKey ( "unreadOnly" )
11
14
return useInfiniteQuery ( {
12
- queryKey : [ "entries" , feedId , inboxId , listId , view , read , limit ] ,
13
- queryFn : ( { pageParam } ) => entrySyncServices . fetchEntries ( { ...props , pageParam } ) ,
15
+ queryKey : [ "entries" , feedId , inboxId , listId , view , unreadOnly , limit ] ,
16
+ queryFn : ( { pageParam } ) =>
17
+ entrySyncServices . fetchEntries ( { ...props , pageParam, read : unreadOnly ? false : undefined } ) ,
14
18
getNextPageParam : ( lastPage ) =>
15
19
listId
16
20
? lastPage . data ?. at ( - 1 ) ?. entries . insertedAt
0 commit comments