Rebase with cleaning up fetchingEvents actions

This commit is contained in:
Franc Camps-Febrer
2018-12-07 09:06:47 +00:00
parent aeec3ee239
commit ccd917f73b
5 changed files with 33 additions and 33 deletions

View File

@@ -49,9 +49,8 @@ class Dashboard extends React.Component {
handleSelect(selected) {
if (selected) {
let eventsToSelect = selected.map(event => this.getEventById(event.id));
const p = this.props.ui.tools.parser;
eventsToSelect = eventsToSelect.sort((a, b) => p(a.timestamp) - p(b.timestamp))
console.log(eventsToSelect, selected)
eventsToSelect = eventsToSelect.sort((a, b) => parseDate(a.timestamp) - parseDate(b.timestamp))
this.props.actions.fetchSelected(eventsToSelect)
}

View File

@@ -26,7 +26,7 @@ class NarrativeCard extends React.Component {
componentDidUpdate() {
if (this.props.narrative !== null) {
const step = this.props.narrative.steps[this.state.step];
this.props.onSelect([step.id]);
this.props.onSelect([step]);
}
}
@@ -42,7 +42,7 @@ class NarrativeCard extends React.Component {
}
render() {
if (this.props.narrative !== null) {
if (this.props.narrative !== null && this.props.narrative.steps[this.state.step]) {
const steps = this.props.narrative.steps;
const step = steps[this.state.step];