fix(showLoading): Make showLoading more robust

This commit is contained in:
Stuart Taylor
2018-03-07 09:53:54 +00:00
parent cebf72701e
commit 9f7084f7b7
2 changed files with 7 additions and 7 deletions

View File

@ -72,7 +72,6 @@ export function fetchChallengesForBlockEpic(
block: blockName = 'basic-html-and-html5' block: blockName = 'basic-html-and-html5'
} = challengeSelector(state); } = challengeSelector(state);
const lang = langSelector(state); const lang = langSelector(state);
if (fetchAnotherBlock) { if (fetchAnotherBlock) {
const fullBlocks = fullBlocksSelector(state); const fullBlocks = fullBlocksSelector(state);
if (fullBlocks.includes(payload)) { if (fullBlocks.includes(payload)) {

View File

@ -9,16 +9,17 @@ import { challengeUpdated } from './redux';
import CompletionModal from './Completion-Modal.jsx'; import CompletionModal from './Completion-Modal.jsx';
import AppChildContainer from '../../Child-Container.jsx'; import AppChildContainer from '../../Child-Container.jsx';
import { OverlayLoader } from '../../helperComponents'; import { OverlayLoader } from '../../helperComponents';
import { fullBlocksSelector } from '../../entities';
import { paramsSelector } from '../../Router/redux';
const mapStateToProps = createSelector( const mapStateToProps = createSelector(
challengeSelector, challengeSelector,
challenge => { fullBlocksSelector,
const { description } = challenge; paramsSelector,
return { (challenge, fullBlocks, { block }) => ({
challenge, challenge,
showLoading: !description || description.length === 0 showLoading: !fullBlocks.includes(block)
}; })
}
); );
const mapDispatchToProps = { challengeUpdated }; const mapDispatchToProps = { challengeUpdated };