diff --git a/embark-ui/src/reducers/index.js b/embark-ui/src/reducers/index.js index e13444948..c91cd65c7 100644 --- a/embark-ui/src/reducers/index.js +++ b/embark-ui/src/reducers/index.js @@ -119,7 +119,8 @@ function loadingEntities(state = {}, action) { return state; } let newState = {}; - newState[action.type].loading = action.loading; + if(!newState[action.type]) newState[action.type] = {}; + newState[action.type].loading = action.loading || 'Loading...'; return {...state, ...newState}; } diff --git a/embark-ui/src/reducers/selectors.js b/embark-ui/src/reducers/selectors.js index 66a5d7bb1..0d16b08aa 100644 --- a/embark-ui/src/reducers/selectors.js +++ b/embark-ui/src/reducers/selectors.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import {REQUEST, SUCCESS, FAILURE, FIDDLE, FIDDLE_DEPLOY} from '../actions'; +import {REQUEST, FIDDLE} from '../actions/index.js'; export function getAccounts(state) { return state.entities.accounts; @@ -106,10 +106,11 @@ export function getMessages(state) { } export function getFiddle(state) { + const loadingEntity = state.loadingEntities[FIDDLE[REQUEST]]; return { data: _.last(state.entities.fiddles), error: _.last(state.errorEntities.fiddles), - loading: state.loadingEntities[FIDDLE[REQUEST]] + loading: loadingEntity ? loadingEntity.loading : undefined }; }