From aeec3ee2395dace28e3e3e6a83da2ab7e5256939 Mon Sep 17 00:00:00 2001 From: Franc Camps-Febrer Date: Fri, 7 Dec 2018 08:47:33 +0000 Subject: [PATCH] Handle error for narrative url not functional --- src/selectors/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/selectors/index.js b/src/selectors/index.js index c994e2a..76f8f40 100644 --- a/src/selectors/index.js +++ b/src/selectors/index.js @@ -3,13 +3,13 @@ import { } from 'reselect' // Input selectors -export const getEvents = state => state.domain.events -export const getLocations = state => state.domain.locations -export const getCategories = state => state.domain.categories -export const getNarratives = state => state.domain.narratives +export const getEvents = state => state.domain.events; +export const getLocations = state => state.domain.locations; +export const getCategories = state => state.domain.categories; +export const getNarratives = state => state.domain.narratives; export const getSites = (state) => { - if (process.env.features.USE_SITES) return state.domain.sites - return [] + if (process.env.features.USE_SITES) return state.domain.sites; + return []; } export const getNotifications = state => state.domain.notifications; export const getTagTree = state => state.domain.tags; @@ -116,9 +116,10 @@ export const selectNarratives = createSelector( narratives[key].byId[step.id].prev = (i > 0) ? steps[i - 1] : null; }); - narratives[key] = Object.assign(narrativeMetadata.find(n => n.id === key), narratives[key]); + if (narrativeMetadata.find(n => n.id === key)) { + narratives[key] = Object.assign(narrativeMetadata.find(n => n.id === key), narratives[key]); + } }); - console.log(narrativeMetadata, narratives) return Object.values(narratives); });