From 8d62273b2bd89a39af5da9f3162ed203ea13ddf5 Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munt@gmail.com> Date: Mon, 21 May 2018 11:22:53 +0300 Subject: [PATCH] (dashboard-card): fix bug when no collections present --- .../src/components/Dashboard/DashboardCard.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/components-faraday/src/components/Dashboard/DashboardCard.js b/packages/components-faraday/src/components/Dashboard/DashboardCard.js index f7fb17e8a..baedc2781 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardCard.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardCard.js @@ -168,7 +168,8 @@ const DashboardCard = ({ const isHEToManuscript = (state, collectionId) => { const currentUserId = get(state, 'currentUser.user.id') - const collection = state.collections.find(c => c.id === collectionId) || {} + const collections = get(state, 'collections') || [] + const collection = collections.find(c => c.id === collectionId) || {} const userInvitation = collection.invitations.find( i => i.role === 'handlingEditor' && i.userId === currentUserId, ) -- GitLab