Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix surah still display Loading even in last of surah
  • Loading branch information
aslamhadi committed Dec 8, 2016
commit d65b8f047a8d33bf3cbafc2a5a35d459f53a18d5
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