From 0e849395aab06b3c05b609740ebc94cf3a5cd258 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 10 Mar 2021 13:44:13 +0100 Subject: navigating around, fix api filtering, add episode stats --- animism-align/frontend/app/views/editor/editor.gate.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 5076350..87ca367 100644 --- a/animism-align/frontend/app/views/editor/editor.gate.js +++ b/animism-align/frontend/app/views/editor/editor.gate.js @@ -6,9 +6,12 @@ import { Loader } from 'app/common' import actions from 'app/actions' class EditorGate extends Component { + state = { + ready: false, + } + constructor(props) { super(props) - this.load() } componentDidMount() { @@ -30,13 +33,17 @@ class EditorGate extends Component { 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 + this.setState({ ready: false }) const episode = this.props.episode.lookup[this.props.episode_id] const project = this.props.project.lookup[episode.project_id] actions.site.loadEpisode(project, episode) + .then(() => { + this.setState({ ready: true }) + }) } render() { - if (parseInt(this.props.episode_id) === parseInt(this.props.current_episode_id)) { + if (this.state.ready && parseInt(this.props.episode_id) === parseInt(this.props.current_episode_id)) { return this.props.children } return ( @@ -48,7 +55,7 @@ class EditorGate extends Component { const mapStateToProps = state => ({ episode: state.episode.index, project: state.project.index, - current_episode_id: state.site.episode.id, + current_episode_id: state.site.episode ? state.site.episode.id : 0, }) export default connect(mapStateToProps)(EditorGate) \ No newline at end of file -- cgit v1.2.3-70-g09d2