fix crash on invite page

This commit is contained in:
zeppi 2021-03-25 16:26:33 -04:00 committed by jessopb
parent 33c325031d
commit 7fdc3d2919

View file

@ -16,18 +16,20 @@ export default function LivestreamLink(props: Props) {
const livestreamChannelId = channelClaim.claim_id || ''; // TODO: fail in a safer way, probably const livestreamChannelId = channelClaim.claim_id || ''; // TODO: fail in a safer way, probably
React.useEffect(() => { React.useEffect(() => {
Lbry.claim_search({ if (livestreamChannelId) {
channel_ids: [livestreamChannelId], Lbry.claim_search({
has_no_source: true, channel_ids: [livestreamChannelId],
claim_type: ['stream'], has_no_source: true,
}) claim_type: ['stream'],
.then((res) => {
if (res && res.items && res.items.length > 0) {
const claim = res.items[res.items.length - 1];
setLivestreamClaim(claim);
}
}) })
.catch(() => {}); .then((res) => {
if (res && res.items && res.items.length > 0) {
const claim = res.items[res.items.length - 1];
setLivestreamClaim(claim);
}
})
.catch(() => {});
}
}, [livestreamChannelId]); }, [livestreamChannelId]);
React.useEffect(() => { React.useEffect(() => {