Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion src/components/Audioplayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ export class Audioplayer extends Component {
}

componentWillUnmount() {
const { files, currentFile } = this.props;
const { files, currentFile, update } = this.props;
debug('component:Audioplayer', 'componentWillUnmount');

if (files[currentFile]) {
return this.handleRemoveFileListeners(files[currentFile]);
}

update({
currentTime: 0
});

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class Surah extends Component {
<Audioplayer
chapter={chapter}
verses={verses}
currentVerse={verses[currentVerse]}
currentVerse={verses[currentVerse] || verses[Object.keys(verses)[0]]}
Copy link
Contributor

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.

https://github.com/imadmk/quran.com-frontend/blob/f178b4c43fae01bd3f549d8c12aaa0c167943346/src/containers/Surah/index.js#L497

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onLoadAyahs={this.handleLazyLoadAyahs}
/>}
</div>
Expand Down