Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
fix surah still display Loading even in last of surah (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslamhadi authored and mmahalwy committed Dec 9, 2016
1 parent bc4775f commit 0d4056c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ function mapStateToProps(state, ownProps) {
const surahId = parseInt(ownProps.params.surahId, 10);
const surah: Object = state.surahs.entities[surahId];
const ayahs: Object = state.ayahs.entities[surahId];
const ayahIds = new Set(Object.keys(ayahs).map(key => parseInt(key.split(':')[1], 10)));
const ayahArray = Object.keys(ayahs).map(key => parseInt(key.split(':')[1], 10));
const ayahIds = new Set(ayahArray);
const lastAyahInArray = ayahArray.slice(-1)[0];

return {
surah,
Expand All @@ -486,7 +488,7 @@ function mapStateToProps(state, ownProps) {
currentAyah: state.audioplayer.currentAyah,
isAuthenticated: state.auth.loaded,
currentWord: state.ayahs.currentWord,
isEndOfSurah: ayahIds.size === surah.ayat,
isEndOfSurah: lastAyahInArray === surah.ayat,
surahs: state.surahs.entities,
bookmarks: state.bookmarks.entities,
isLoading: state.ayahs.loading,
Expand Down

0 comments on commit 0d4056c

Please sign in to comment.