feat(mobile): use feedIdList

This commit is contained in:
DIYgod
2025-04-09 16:23:15 +08:00
parent 98468d4183
commit c31a933baf
3 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -9,10 +9,10 @@ import { entrySyncServices, useEntryStore } from "./store"
import type { EntryModel, FetchEntriesProps } from "./types"
export const usePrefetchEntries = (props: Omit<FetchEntriesProps, "pageParam" | "read"> | null) => {
const { feedId, inboxId, listId, view, limit } = props || {}
const { feedId, inboxId, listId, view, limit, feedIdList } = props || {}
const unreadOnly = useGeneralSettingKey("unreadOnly")
return useInfiniteQuery({
queryKey: ["entries", feedId, inboxId, listId, view, unreadOnly, limit],
queryKey: ["entries", feedId, inboxId, listId, view, unreadOnly, limit, feedIdList],
queryFn: ({ pageParam }) =>
entrySyncServices.fetchEntries({ ...props, pageParam, read: unreadOnly ? false : undefined }),
getNextPageParam: (lastPage) => lastPage.data?.at(-1)?.entries.publishedAt,
+3 -1
View File
@@ -342,12 +342,14 @@ class EntryActions {
class EntrySyncServices {
async fetchEntries(props: FetchEntriesProps) {
const { feedId, inboxId, listId, view, read, limit, pageParam, isCollection } = props
const { feedId, inboxId, listId, view, read, limit, pageParam, isCollection, feedIdList } =
props
const params = getEntriesParams({
feedId,
inboxId,
listId,
view,
feedIdList,
})
const res = params.inboxId
? await apiClient.entries.inbox.$post({
+4
View File
@@ -19,11 +19,13 @@ export function getEntriesParams({
inboxId,
listId,
view,
feedIdList,
}: {
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
feedIdList?: string[]
}) {
const params: {
feedId?: string
@@ -37,6 +39,8 @@ export function getEntriesParams({
params.inboxId = `${inboxId}`
} else if (listId) {
params.listId = `${listId}`
} else if (feedIdList) {
params.feedIdList = feedIdList
} else if (feedId) {
if (feedId === FEED_COLLECTION_LIST) {
params.isCollection = true