-
Notifications
You must be signed in to change notification settings - Fork 370
Fix audio player bar not loaded when changing chapter #854
Conversation
- Fix currentVerse undefined - Restart currentTime to 0 when chapter changed
|
rebuild |
1 similar comment
|
rebuild |
|
@imadmk Jenkins will soon generate an environment for this pr, so we can test and I'll approve the pr. thank you |
|
Deployed to: http://staging.quran.com:32933 |
|
Deployed to: http://staging.quran.com:32934 |
| chapter={chapter} | ||
| verses={verses} | ||
| currentVerse={verses[currentVerse]} | ||
| currentVerse={verses[currentVerse] || verses[Object.keys(verses)[0]]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we're doing the same thing in mapStateToProps, currentVerse shouldn't be nil.
Also this will fix the audio player what about other components which are using currentVerse ? see renderVerses and renderLines for example. I believe we should fix mapStateToProps and make sure current verse isn't undefine at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@imadmk like I said Fixed. And closing this. |
|
I see. Great it fixed. Because that will fix many UI flows. |
Assalamualaikum
Bismillah this is my first contribution.
Insha Allah this commit will fix issue 815 and 830 and maybe 675 too
Fix currentVerse undefined
I found when user change verse, the currentVerse is not changed. So if user already on 4th verse on Surah 1 and move to Surah 3 for example, it will cause Audioplayer breaks (on staging, and endless loading on production) because
ownProps.currentVerseis undefined onfiles[ownProps.currentVerse.verseKey](on Audioplayer/index.js).This is caused by undefined
verses[currentVerse]' on 'Surah/index.jsupon rendering Audioplayer.When new surah loads,
verseswill be assigned bystate.verses.entities[chapterId]so it will be filled with {3:1, 3:2, 3:3 ...}.So it will be undefined since
currentVerseis still on1:4and verses[1:4] does not exist.This fix will assign
currentVerseto first element from verses when it is undefined.Restart currentTime to 0 when chapter changed
After audio player succesfully loaded, the state of
currentTimedid not change. So if the player already played to half of the ayah, it won't reset to0in new Surah.This fix will reset the
currentTimeto 0 every unmounting Audioplayer element.