feat: get full list feeds

This commit is contained in:
DIYgod 2025-02-11 21:34:57 +08:00
parent e8e385105a
commit d9bc62b44c
No known key found for this signature in database
4 changed files with 11 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import { useTranslation } from "react-i18next"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useList } from "~/queries/lists"
import { useFeedById } from "~/store/feed"
import { useListById } from "~/store/list"
@ -21,7 +22,9 @@ import { feedColumnStyles } from "./styles"
export const ListFeedList: FC<{ listId: string }> = ({ listId }) => {
const { t } = useTranslation()
const list = useListById(listId)
const cachedList = useListById(listId)
const res = useList({ id: listId, noExtras: true })
const list = res.data?.list || cachedList
const currentFeedId = useRouteParamsSelector((s) => s.feedId)
if (!list) return null

View File

@ -7,13 +7,13 @@ export const lists = {
defineQuery(["lists"], async () => listActions.fetchOwnedLists(), {
rootKey: ["lists"],
}),
byId: ({ id }: { id: string }) =>
defineQuery(["lists", id], async () => listActions.fetchListById(id), {
byId: ({ id, noExtras }: { id: string; noExtras?: boolean }) =>
defineQuery(["lists", id, noExtras], async () => listActions.fetchListById(id, noExtras), {
rootKey: ["lists"],
}),
}
export const useList = ({ id }: { id?: string }) =>
useAuthQuery(lists.byId({ id: id! }), {
export const useList = ({ id, noExtras }: { id?: string; noExtras?: boolean }) =>
useAuthQuery(lists.byId({ id: id!, noExtras }), {
enabled: !!id,
})

View File

@ -112,8 +112,8 @@ class ListActionStatic {
await tx.run()
}
async fetchListById(id: string) {
const res = await apiClient.lists.$get({ query: { listId: id } })
async fetchListById(id: string, noExtras?: boolean) {
const res = await apiClient.lists.$get({ query: { listId: id, noExtras } })
this.upsertMany([res.data.list])
return res.data

View File

@ -15810,6 +15810,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, ({
input: {
query: {
listId: string;
noExtras?: boolean | undefined;
};
};
output: {