From a16640434701c5230aa47e775ac5a43be35c8fcb Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 20 Feb 2018 09:31:08 -0700 Subject: [PATCH] fix for action count null --- graph/loaders/actions.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/graph/loaders/actions.js b/graph/loaders/actions.js index b5ea31a3f..77cc7138d 100644 --- a/graph/loaders/actions.js +++ b/graph/loaders/actions.js @@ -1,6 +1,6 @@ const DataLoader = require('dataloader'); const util = require('./util'); -const { first, get, merge, remove, groupBy, reduce } = require('lodash'); +const { first, get, merge, remove, groupBy, reduce, isNil } = require('lodash'); /** * Gets actions based on their item id's. @@ -35,10 +35,12 @@ const genActionsAuthoredWithID = ( * @param {Object} action_counts the action count object */ const iterateActionCounts = action_counts => - Object.keys(action_counts).map(action_type => ({ - count: action_counts[action_type], - action_type: action_type.toUpperCase(), - })); + !isNil(action_counts) + ? Object.keys(action_counts).map(action_type => ({ + count: action_counts[action_type], + action_type: action_type.toUpperCase(), + })) + : []; /** * getUserActions will get the actions made by the user for this specific