From 54b88696cd0a7a909c86c673ea57d93c27133059 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 20 Jun 2018 15:08:31 -0400 Subject: [PATCH] fix: fetch subscriptions if there are no claims loaded --- src/renderer/page/subscriptions/view.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/renderer/page/subscriptions/view.jsx b/src/renderer/page/subscriptions/view.jsx index 1ea53e306..c94c6fc76 100644 --- a/src/renderer/page/subscriptions/view.jsx +++ b/src/renderer/page/subscriptions/view.jsx @@ -6,6 +6,7 @@ import * as NOTIFICATION_TYPES from 'constants/notification_types'; import Button from 'component/button'; import FileList from 'component/fileList'; import type { Claim } from 'types/claim'; +import isDev from 'electron-is-dev'; type Props = { doFetchClaimsByChannel: (string, number) => void, @@ -42,7 +43,18 @@ export default class extends React.PureComponent { const subscriptionClaimMap = {}; subscriptionClaims.forEach(claim => { - subscriptionClaimMap[claim.uri] = 1; + /* + This check added 6/20/18 to fix function receiving empty claims unexpectedly. + The better fix is ensuring channels aren't added to byId if there are no associated claims + We are adding this now with the redesign release to ensure users see the correct subscriptions + */ + if (claim.claims.length) { + subscriptionClaimMap[claim.uri] = 1; + } else if (isDev) { + console.error( + `claim for ${claim.uri} was added to byId in redux but there are no loaded fetched claims` + ); + } }); subscriptions.forEach(sub => {