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

fixes the bug where you get a stacktrace when you try to back/forward… #270

Merged
merged 2 commits into from
Apr 8, 2016
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/components/Audioplayer/Track/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export default class Track extends Component {
};

componentDidMount() {
this.onFileLoad(this.props.file);
if (this.props.file) {
this.onFileLoad(this.props.file);
}
}

componentWillUnmount() {
Expand Down
14 changes: 12 additions & 2 deletions src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,22 @@ export default class Surah extends Component {
if (params.range.includes('-')) {
const [from, to] = params.range.split('-').map(num => parseInt(num, 10));
const array = Array(to - from).fill(from);
const translations = array.map((fromAyah, index) => ayahs[`${surah.id}:${fromAyah + index}`].content[0].text);
const translations = array.map((fromAyah, index) => {
const ayah = ayahs[`${surah.id}:${fromAyah + index}`];
if (ayah && ayah.content && ayah.content[0]) {
return ayah.content[0].text;
}
});
const content = translations.join(' - ').slice(0, 250);

return `Surat ${surah.name.simple} [verse ${params.range}] - ${content}`;
} else {
return `Surat ${surah.name.simple} [verse ${params.range}] - ${ayahs[`${surah.id}:${params.range}`].content[0].text}`;
const ayah = ayahs[`${surah.id}:${params.range}`];
if (ayah && ayah.content && ayah.content[0]) {
return `Surat ${surah.name.simple} [verse ${params.range}] - ${ayah.content[0].text}`;
} else {
return `Surat ${surah.name.simple} [verse ${params.range}]`;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/redux/modules/ayahs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function reducer(state = initialState, action = {}) {
case CLEAR_CURRENT:
return {
...state,
current: null,
entities: {
...state.entities,
[action.id]: {}
Expand Down