Merge branch 'gallery-crash' into 'main'
AccountGallery: fix crash when account isn't loaded yet See merge request soapbox-pub/soapbox!2831
This commit is contained in:
commit
e5e9fb3a59
1 changed files with 2 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import { List as ImmutableList } from 'immutable';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
@ -13,7 +14,6 @@ import { getAccountGallery } from 'soapbox/selectors';
|
|||
|
||||
import MediaItem from './components/media-item';
|
||||
|
||||
import type { List as ImmutableList } from 'immutable';
|
||||
import type { Attachment, Status } from 'soapbox/types/entities';
|
||||
|
||||
interface ILoadMoreMedia {
|
||||
|
@ -41,7 +41,7 @@ const AccountGallery = () => {
|
|||
isUnavailable,
|
||||
} = useAccountLookup(username, { withRelationship: true });
|
||||
|
||||
const attachments: ImmutableList<Attachment> = useAppSelector((state) => getAccountGallery(state, account!.id));
|
||||
const attachments: ImmutableList<Attachment> = useAppSelector((state) => account ? getAccountGallery(state, account.id) : ImmutableList());
|
||||
const isLoading = useAppSelector((state) => state.timelines.get(`account:${account?.id}:media`)?.isLoading);
|
||||
const hasMore = useAppSelector((state) => state.timelines.get(`account:${account?.id}:media`)?.hasMore);
|
||||
const next = useAppSelector(state => state.timelines.get(`account:${account?.id}:media`)?.next);
|
||||
|
|
Loading…
Reference in a new issue