From 4d33d67798117331b299debd1730599bd6abcdec Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 9 Nov 2017 16:14:34 -0500 Subject: [PATCH] fix empty media folder loading error --- src/reducers/mediaLibrary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reducers/mediaLibrary.js b/src/reducers/mediaLibrary.js index fee74919..17aeafae 100644 --- a/src/reducers/mediaLibrary.js +++ b/src/reducers/mediaLibrary.js @@ -40,13 +40,13 @@ const mediaLibrary = (state = Map({ isVisible: false, controlMedia: Map() }), ac map.set('isPaginating', action.payload.page > 1); }); case MEDIA_LOAD_SUCCESS: { - const { files, page, canPaginate, dynamicSearch, dynamicSearchQuery } = action.payload; + const { files = [], page, canPaginate, dynamicSearch, dynamicSearchQuery } = action.payload; const filesWithKeys = files.map(file => ({ ...file, key: uuid() })); return state.withMutations(map => { map.set('isLoading', false); map.set('isPaginating', false); map.set('page', page); - map.set('hasNextPage', canPaginate && files && files.length > 0); + map.set('hasNextPage', canPaginate && files.length > 0); map.set('dynamicSearch', dynamicSearch); map.set('dynamicSearchQuery', dynamicSearchQuery); map.set('dynamicSearchActive', !!dynamicSearchQuery);