diff --git a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts b/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts index 1d009d87f7..e2bce48152 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts @@ -3,6 +3,7 @@ import * as v from 'valibot'; import { Entities } from 'pl-fe/entity-store/entities'; import { useEntity } from 'pl-fe/entity-store/hooks/useEntity'; import { useClient } from 'pl-fe/hooks/useClient'; +import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; import type { Relationship } from 'pl-api'; @@ -12,13 +13,14 @@ interface UseRelationshipOpts { const useRelationship = (accountId: string | undefined, opts: UseRelationshipOpts = {}) => { const client = useClient(); + const { isLoggedIn } = useLoggedIn(); const { enabled = false } = opts; const { entity: relationship, ...result } = useEntity( [Entities.RELATIONSHIPS, accountId!], () => client.accounts.getRelationships([accountId!]), { - enabled: enabled && !!accountId, + enabled: enabled && isLoggedIn && !!accountId, schema: v.pipe(v.any(), v.transform(arr => arr[0])), }, ); diff --git a/packages/pl-fe/src/components/media-gallery.tsx b/packages/pl-fe/src/components/media-gallery.tsx index 9a5d2d81d6..af99025bb8 100644 --- a/packages/pl-fe/src/components/media-gallery.tsx +++ b/packages/pl-fe/src/components/media-gallery.tsx @@ -289,6 +289,7 @@ const MediaGallery: React.FC = (props) => { height, visible, } = props; + const [width, setWidth] = useState(defaultWidth); const node = useRef(null); diff --git a/packages/pl-fe/src/queries/trends.ts b/packages/pl-fe/src/queries/trends.ts index 812af96899..29f3b3b9d8 100644 --- a/packages/pl-fe/src/queries/trends.ts +++ b/packages/pl-fe/src/queries/trends.ts @@ -3,12 +3,14 @@ import { useQuery } from '@tanstack/react-query'; import { fetchTrendsSuccess } from 'pl-fe/actions/trends'; import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; import { useClient } from 'pl-fe/hooks/useClient'; +import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; import type { Tag } from 'pl-api'; const useTrends = () => { const dispatch = useAppDispatch(); const client = useClient(); + const { isLoggedIn } = useLoggedIn(); const getTrends = async() => { const data = await client.trends.getTrendingTags(); @@ -23,6 +25,7 @@ const useTrends = () => { queryFn: getTrends, placeholderData: [], staleTime: 600000, // 10 minutes + enabled: isLoggedIn, }); return result;