From 9f40b7ff7c83152b8e651faa628554059321ee93 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Thu, 19 Mar 2020 12:00:15 -0400 Subject: [PATCH] call publish event if report call fails --- ui/component/creatorAnalytics/view.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/component/creatorAnalytics/view.jsx b/ui/component/creatorAnalytics/view.jsx index ba272c2fe..63efdc4e9 100644 --- a/ui/component/creatorAnalytics/view.jsx +++ b/ui/component/creatorAnalytics/view.jsx @@ -12,6 +12,7 @@ import usePersistedState from 'effects/use-persisted-state'; import Button from 'component/button'; import Yrbl from 'component/yrbl'; import { useHistory } from 'react-router-dom'; +import analytics from 'analytics'; type Props = { channels: Array, @@ -45,8 +46,9 @@ export default function CreatorAnalytics(props: Props) { } }, [selectedChannelUrl, firstChannelUrl, channelFoundForSelectedChannelUrl]); + const channelForEffect = JSON.stringify(selectedChannelClaim); React.useEffect(() => { - if (selectedChannelClaimId) { + if (selectedChannelClaimId && channelForEffect) { setFetchingStats(true); Lbryio.call('reports', 'content', { claim_id: selectedChannelClaimId }) .then(res => { @@ -54,10 +56,12 @@ export default function CreatorAnalytics(props: Props) { setStats(res); }) .catch(() => { + const channelToSend = JSON.parse(channelForEffect); + analytics.apiLogPublish(channelToSend); setFetchingStats(false); }); } - }, [selectedChannelClaimId, setFetchingStats, setStats]); + }, [selectedChannelClaimId, channelForEffect, setFetchingStats, setStats]); return (