Do not throw error when trying to play empty collections.

This commit is contained in:
Franco Montenegro 2022-04-28 08:36:55 -03:00 committed by jessopb
parent 3671e855cb
commit de825fd4dc
3 changed files with 6 additions and 3 deletions

View file

@ -57,6 +57,9 @@ function CollectionActions(props: Props) {
const doPlay = React.useCallback( const doPlay = React.useCallback(
(playUri) => { (playUri) => {
if (!playUri) {
return;
}
const navigateUrl = formatLbryUrlForWeb(playUri); const navigateUrl = formatLbryUrlForWeb(playUri);
push({ push({
pathname: navigateUrl, pathname: navigateUrl,

View file

@ -33,7 +33,7 @@ function CollectionPreviewOverlay(props: Props) {
collectionItemUrls.map((item, index) => { collectionItemUrls.map((item, index) => {
if (index < 2) { if (index < 2) {
return ( return (
<div className="collection-preview__overlay-grid-items"> <div key={item} className="collection-preview__overlay-grid-items">
<FileThumbnail uri={item} key={item} /> <FileThumbnail uri={item} key={item} />
</div> </div>
); );

View file

@ -95,7 +95,7 @@ export default function CollectionsListMine(props: Props) {
{builtin.map((list: Collection) => { {builtin.map((list: Collection) => {
const { items: itemUrls } = list; const { items: itemUrls } = list;
return ( return (
<> <React.Fragment key={list.name}>
{Boolean(itemUrls && itemUrls.length) && ( {Boolean(itemUrls && itemUrls.length) && (
<div className="claim-grid__wrapper" key={list.name}> <div className="claim-grid__wrapper" key={list.name}>
<h1 className="claim-grid__header"> <h1 className="claim-grid__header">
@ -124,7 +124,7 @@ export default function CollectionsListMine(props: Props) {
<ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} /> <ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} />
</div> </div>
)} )}
</> </React.Fragment>
); );
})} })}
<div className="claim-grid__wrapper"> <div className="claim-grid__wrapper">