diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-10 13:44:13 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-10 13:44:13 +0100 |
| commit | 0e849395aab06b3c05b609740ebc94cf3a5cd258 (patch) | |
| tree | 2efeee477043d7d3180047932231aef13dff1b9a /animism-align/frontend/app/views/editor/editor.gate.js | |
| parent | 554695be3d2c0ed122fa83b6b0ac76e338116268 (diff) | |
navigating around, fix api filtering, add episode stats
Diffstat (limited to 'animism-align/frontend/app/views/editor/editor.gate.js')
| -rw-r--r-- | animism-align/frontend/app/views/editor/editor.gate.js | 13 |
1 files changed, 10 insertions, 3 deletions
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 |
