fix: persist rsshub and trending query

This commit is contained in:
Stephen Zhou
2025-07-08 17:20:32 +08:00
parent cc4cc2ec9f
commit 7a95a159f7
4 changed files with 14 additions and 4 deletions
@@ -69,6 +69,9 @@ export function Trending({
},
})
},
meta: {
persist: true,
},
})
useEffect(() => {
@@ -1,5 +1,5 @@
import { Avatar, AvatarFallback, AvatarImage } from "@follow/components/ui/avatar/index.jsx"
import { usePrefetchUser, useWhoami } from "@follow/store/user/hooks"
import { usePrefetchUser, useUserById, useWhoami } from "@follow/store/user/hooks"
import { getColorScheme, stringToHue } from "@follow/utils/color"
import { cn } from "@follow/utils/utils"
@@ -34,13 +34,14 @@ export const UserAvatar = ({
const whoami = useWhoami()
const presentUserProfile = usePresentUserProfileModal("drawer")
const profile = usePrefetchUser(userId)
usePrefetchUser(userId)
const profile = useUserById(userId)
if (!userId && status !== "authenticated") {
return <LoginButton {...props} />
}
const renderUserData = userId ? profile.data : whoami
const renderUserData = userId ? profile : whoami
const randomColor = stringToHue(renderUserData?.name || "")
return (
<div
@@ -45,6 +45,9 @@ export const Component = () => {
{
staleTime: 1000 * 60 * 60 * 24, // 1 day
placeholderData: keepPreviousData,
meta: {
persist: true,
},
},
)
@@ -53,6 +56,9 @@ export const Component = () => {
const rsshubAnalytics = useAuthQuery(Queries.discover.rsshubAnalytics({ lang }), {
staleTime: 1000 * 60 * 60 * 24, // 1 day
placeholderData: keepPreviousData,
meta: {
persist: true,
},
})
const rsshubAnalyticsData: Awaited<
@@ -46,7 +46,7 @@ export function Component() {
setRightView(null)
}
}, [setRightView, handleAddInstance, t])
const list = useAuthQuery(Queries.rsshub.list())
const list = useAuthQuery(Queries.rsshub.list(), { meta: { persist: true } })
return (
<div className="flex size-full flex-col px-6 py-8">