diff --git a/src/components/repo/RepoStarCount.tsx b/src/components/repo/RepoStarCount.tsx index 6b736b3..6d50d96 100644 --- a/src/components/repo/RepoStarCount.tsx +++ b/src/components/repo/RepoStarCount.tsx @@ -1,6 +1,7 @@ import type { Did } from '@atcute/lexicons' import { IconStar } from '@tabler/icons-react' import { useRepoStarCount } from '../../hooks/useRepoStarCount' +import { useElementVisibility } from '../../hooks/useElementVisibility' import { RepoActionControl } from './RepoActionControl' type RepoStarCountProps = { @@ -9,7 +10,8 @@ type RepoStarCountProps = { } export function RepoStarCount({ repoDid, variant = 'count' }: RepoStarCountProps) { - const { starCount, hasFailed } = useRepoStarCount(repoDid) + const { elementRef, isVisible } = useElementVisibility() + const { starCount, hasFailed } = useRepoStarCount(repoDid, isVisible) if (repoDid === undefined) return null @@ -17,19 +19,23 @@ export function RepoStarCount({ repoDid, variant = 'count' }: RepoStarCountProps if (variant === 'action') { return ( - - + + + + ) } return ( - -