@@ -16,8 +16,10 @@ export const challengeFilesSelector = state => state[ns].challengeFiles;
1616export const challengeMetaSelector = state => state [ ns ] . challengeMeta ;
1717export const challengeTestsSelector = state => state [ ns ] . challengeTests ;
1818export const consoleOutputSelector = state => state [ ns ] . consoleOut ;
19- export const completedChallengesIdsSelector = state =>
20- completedChallengesSelector ( state ) . map ( node => node . id ) ;
19+ export const completedChallengesIdsSelector = createSelector (
20+ completedChallengesSelector ,
21+ completedChallenges => completedChallenges . map ( node => node . id )
22+ ) ;
2123export const isChallengeCompletedSelector = state => {
2224 const completedChallenges = completedChallengesSelector ( state ) ;
2325 const { id : currentChallengeId } = challengeMetaSelector ( state ) ;
@@ -119,17 +121,13 @@ export const currentBlockIdsSelector = createSelector(
119121 }
120122) ;
121123
122- export const completedChallengesInBlockSelector = state => {
123- const completedChallengesIds = completedChallengesIdsSelector ( state ) ;
124- const currentBlockIds = currentBlockIdsSelector ( state ) ;
125- const { id } = challengeMetaSelector ( state ) ;
126-
127- return getCompletedChallengesInBlock (
128- completedChallengesIds ,
129- currentBlockIds ,
130- id
131- ) ;
132- } ;
124+ export const completedChallengesInBlockSelector = createSelector (
125+ completedChallengesIdsSelector ,
126+ currentBlockIdsSelector ,
127+ challengeMetaSelector ,
128+ ( completedChallengesIds , currentBlockIds , { id } ) =>
129+ getCompletedChallengesInBlock ( completedChallengesIds , currentBlockIds , id )
130+ ) ;
133131
134132export const completedPercentageSelector = createSelector (
135133 isSignedInSelector ,
0 commit comments