diff --git a/server/sources/weibo.ts b/server/sources/weibo.ts index cbc786e..128f2d7 100644 --- a/server/sources/weibo.ts +++ b/server/sources/weibo.ts @@ -36,7 +36,10 @@ export default defineSource(async () => { id: k.num, title: k.word, extra: { - icon: k.icon && `/api/proxy?img=${encodeURIComponent(k.icon)}`, + icon: k.icon && { + url: `/api/proxy?img=${encodeURIComponent(k.icon)}`, + scale: 1.5, + }, }, url: `https://s.weibo.com/weibo?q=${encodeURIComponent(keyword)}`, mobileUrl: `https://m.weibo.cn/search?containerid=231522type%3D1%26q%3D${encodeURIComponent(keyword)}&_T_WM=16922097837&v_p=42`, diff --git a/src/components/column/card.tsx b/src/components/column/card.tsx index 0b662bc..1aa717a 100644 --- a/src/components/column/card.tsx +++ b/src/components/column/card.tsx @@ -1,5 +1,4 @@ import type { NewsItem, SourceID, SourceResponse } from "@shared/types" -import type { UseQueryResult } from "@tanstack/react-query" import { useQuery } from "@tanstack/react-query" import clsx from "clsx" import { useInView } from "framer-motion" @@ -25,12 +24,8 @@ export interface ItemsProps extends React.HTMLAttributes { interface NewsCardProps { id: SourceID - inView: boolean handleListeners?: SyntheticListenerMap -} - -interface Query { - query: UseQueryResult + inView: boolean } export const CardWrapper = forwardRef(({ id, isDragged, handleListeners, style, ...props }, dndRef) => { @@ -62,7 +57,7 @@ export const CardWrapper = forwardRef(({ id, isDragg function NewsCard({ id, inView, handleListeners }: NewsCardProps) { const [focusSources, setFocusSources] = useAtom(focusSourcesAtom) const [refetchSource, setRefetchSource] = useAtom(refetchSourcesAtom) - const query = useQuery({ + const { data, isFetching, isPlaceholderData, isError } = useQuery({ queryKey: [id, refetchSource[id]], queryFn: async ({ queryKey }) => { const [_id, _refetchTime] = queryKey as [SourceID, number] @@ -95,7 +90,7 @@ function NewsCard({ id, inView, handleListeners }: NewsCardProps) { })) }, [setRefetchSource, id]) - const isFreshFetching = useMemo(() => query.isFetching && !query.isPlaceholderData, [query]) + const isFreshFetching = useMemo(() => isFetching && !isPlaceholderData, [isFetching, isPlaceholderData]) return ( <> @@ -114,13 +109,13 @@ function NewsCard({ id, inView, handleListeners }: NewsCardProps) { {sources[id]?.title && {sources[id].title}} - +