fix: subscription list loading status
This commit is contained in:
@@ -39,7 +39,7 @@ export function SubscriptionColumn({
|
||||
children,
|
||||
className,
|
||||
}: PropsWithChildren<{ className?: string }>) {
|
||||
usePrefetchSubscription()
|
||||
const { isLoading: isSubscriptionLoading } = usePrefetchSubscription()
|
||||
usePrefetchUnread()
|
||||
|
||||
const carouselRef = useRef<HTMLDivElement>(null)
|
||||
@@ -169,6 +169,7 @@ export function SubscriptionColumn({
|
||||
10,
|
||||
) as FeedViewType
|
||||
}
|
||||
isSubscriptionLoading={isSubscriptionLoading}
|
||||
/>
|
||||
</section>
|
||||
))}
|
||||
|
||||
+15
-1
@@ -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 ? (
|
||||
<SubscriptionListSkeleton />
|
||||
) : (
|
||||
<EmptyFeedList />
|
||||
)}
|
||||
@@ -411,3 +414,14 @@ const useRegisterCommand = () => {
|
||||
)
|
||||
}, [focusableContainerRef, focusActions, getCurrentActiveSubscriptionElement])
|
||||
}
|
||||
|
||||
const SubscriptionListSkeleton = () => (
|
||||
<div className="px-3">
|
||||
{Array.from({ length: 5 }).map((_, index) => (
|
||||
<div key={index} className="flex h-8 items-center justify-between">
|
||||
<Skeleton className="h-4 w-28" />
|
||||
<Skeleton className="size-4" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
||||
+3
-2
@@ -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<HTMLDivElement | null> | ((node: HTMLDivElement | null) => void)
|
||||
}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user