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

Commit d65b8f0

Browse files
committed
fix surah still display Loading even in last of surah
1 parent bc4775f commit d65b8f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/containers/Surah/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ function mapStateToProps(state, ownProps) {
475475
const surahId = parseInt(ownProps.params.surahId, 10);
476476
const surah: Object = state.surahs.entities[surahId];
477477
const ayahs: Object = state.ayahs.entities[surahId];
478-
const ayahIds = new Set(Object.keys(ayahs).map(key => parseInt(key.split(':')[1], 10)));
478+
const ayahArray = Object.keys(ayahs).map(key => parseInt(key.split(':')[1], 10));
479+
const ayahIds = new Set(ayahArray);
480+
const lastAyahInArray = ayahArray.slice(-1)[0];
479481

480482
return {
481483
surah,
@@ -486,7 +488,7 @@ function mapStateToProps(state, ownProps) {
486488
currentAyah: state.audioplayer.currentAyah,
487489
isAuthenticated: state.auth.loaded,
488490
currentWord: state.ayahs.currentWord,
489-
isEndOfSurah: ayahIds.size === surah.ayat,
491+
isEndOfSurah: lastAyahInArray === surah.ayat,
490492
surahs: state.surahs.entities,
491493
bookmarks: state.bookmarks.entities,
492494
isLoading: state.ayahs.loading,

0 commit comments

Comments
 (0)