From 554695be3d2c0ed122fa83b6b0ac76e338116268 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 9 Mar 2021 21:20:03 +0100 Subject: making overview load --- animism-align/frontend/app/views/editor/editor.gate.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'animism-align/frontend/app/views/editor/editor.gate.js') diff --git a/animism-align/frontend/app/views/editor/editor.gate.js b/animism-align/frontend/app/views/editor/editor.gate.js index b835a69..5076350 100644 --- a/animism-align/frontend/app/views/editor/editor.gate.js +++ b/animism-align/frontend/app/views/editor/editor.gate.js @@ -18,32 +18,37 @@ class EditorGate extends Component { componentDidUpdate(prevProps) { if ( this.props.episode_id !== prevProps.episode_id || - this.props.episode.lookup !== prevProps.episode.lookup + this.props.episode.lookup !== prevProps.episode.lookup || + this.props.project.lookup !== prevProps.project.lookup ) { this.load() } } load() { + if (!this.props.project.lookup) return if (!this.props.episode.lookup) return if (!this.props.episode_id) return + if (parseInt(this.props.episode_id) === parseInt(this.props.current_episode_id)) return const episode = this.props.episode.lookup[this.props.episode_id] - actions.site.loadEpisode(episode) + const project = this.props.project.lookup[episode.project_id] + actions.site.loadEpisode(project, episode) } render() { - if (parseInt(this.props.episode_id) === parseInt(this.props.currentEpisodeId)) { + if (parseInt(this.props.episode_id) === parseInt(this.props.current_episode_id)) { return this.props.children } return ( -
+
) } } const mapStateToProps = state => ({ episode: state.episode.index, - currentEpisodeId: state.align.currentEpisodeId, + project: state.project.index, + current_episode_id: state.site.episode.id, }) export default connect(mapStateToProps)(EditorGate) \ No newline at end of file -- cgit v1.2.3-70-g09d2