summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/editor.gate.js
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/editor/editor.gate.js')
-rw-r--r--animism-align/frontend/app/views/editor/editor.gate.js13
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