mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
Reset narrative to first event when switching between narratives
This commit is contained in:
committed by
Lachlan Kermode
parent
196abd27b0
commit
9e16271dbb
@@ -32,6 +32,13 @@ class NarrativeCard extends React.Component {
|
||||
if (prevProps.narrative === this.props.narrative && this.state.step !== prevState.step) {
|
||||
const step = this.props.narrative.steps[this.state.step];
|
||||
this.props.onSelect([step]);
|
||||
} else if (prevProps.narrative !== this.props.narrative && this.props.narrative !== null) {
|
||||
this.setState({
|
||||
step: 0
|
||||
}, () => {
|
||||
const step = this.props.narrative.steps[this.state.step];
|
||||
this.props.onSelect([step]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user