From e81220de63ccd992acbb21029269ef80ded481c6 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 14 Jul 2025 16:45:14 +0800 Subject: [PATCH] fix: subscription list loading status --- .../src/modules/subscription-column/index.tsx | 3 ++- .../subscription-list/SubscriptionList.tsx | 16 +++++++++++++++- .../subscription-list/SubscriptionListGuard.tsx | 5 +++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/index.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/index.tsx index fcea5a0ba..5aafc97d3 100644 --- a/apps/desktop/layer/renderer/src/modules/subscription-column/index.tsx +++ b/apps/desktop/layer/renderer/src/modules/subscription-column/index.tsx @@ -39,7 +39,7 @@ export function SubscriptionColumn({ children, className, }: PropsWithChildren<{ className?: string }>) { - usePrefetchSubscription() + const { isLoading: isSubscriptionLoading } = usePrefetchSubscription() usePrefetchUnread() const carouselRef = useRef(null) @@ -169,6 +169,7 @@ export function SubscriptionColumn({ 10, ) as FeedViewType } + isSubscriptionLoading={isSubscriptionLoading} /> ))} diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionList.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionList.tsx index 0a5b3e037..0926906a3 100644 --- a/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionList.tsx +++ b/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionList.tsx @@ -5,6 +5,7 @@ import { useGlobalFocusableScopeSelector, } from "@follow/components/common/Focusable/hooks.js" import { ScrollArea } from "@follow/components/ui/scroll-area/index.js" +import { Skeleton } from "@follow/components/ui/skeleton/index.jsx" import { FeedViewType } from "@follow/constants" import { useInboxList } from "@follow/store/inbox/hooks" import { useListById } from "@follow/store/list/hooks" @@ -45,7 +46,7 @@ import { ListHeader } from "./ListHeader" import { StarredItem } from "./StarredItem" import type { SubscriptionProps } from "./SubscriptionListGuard" -const SubscriptionImpl = ({ ref, className, view }: SubscriptionProps) => { +const SubscriptionImpl = ({ ref, className, view, isSubscriptionLoading }: SubscriptionProps) => { const autoGroup = useGeneralSettingKey("autoGroup") const feedsData = useFeedsGroupedData(view, autoGroup) const listSubIds = useSubscriptionListIds(view) @@ -293,6 +294,8 @@ const SubscriptionImpl = ({ ref, className, view }: SubscriptionProps) => { data={feedsData} categoryOpenStateData={categoryOpenStateData} /> + ) : isSubscriptionLoading ? ( + ) : ( )} @@ -411,3 +414,14 @@ const useRegisterCommand = () => { ) }, [focusableContainerRef, focusActions, getCurrentActiveSubscriptionElement]) } + +const SubscriptionListSkeleton = () => ( +
+ {Array.from({ length: 5 }).map((_, index) => ( +
+ + +
+ ))} +
+) diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionListGuard.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionListGuard.tsx index a34308d59..2b005cd19 100644 --- a/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionListGuard.tsx +++ b/apps/desktop/layer/renderer/src/modules/subscription-column/subscription-list/SubscriptionListGuard.tsx @@ -4,7 +4,7 @@ import { cn } from "@follow/utils" import { SubscriptionList as FeedListDesktop } from "./SubscriptionList" export const SubscriptionListGuard = function SubscriptionListGuard(props: SubscriptionProps) { - const { ref, className, view } = props + const { ref, className, view, isSubscriptionLoading } = props if (typeof view !== "number") { return null @@ -14,12 +14,13 @@ export const SubscriptionListGuard = function SubscriptionListGuard(props: Subsc className={cn("flex size-full flex-col text-sm", className)} view={view} ref={ref} + isSubscriptionLoading={isSubscriptionLoading} /> ) } export type SubscriptionProps = ComponentType< - { className?: string; view: FeedViewType } & { + { className?: string; view: FeedViewType; isSubscriptionLoading: boolean } & { ref?: React.Ref | ((node: HTMLDivElement | null) => void) } >