diff --git a/src/Map.js b/src/Map.js index c845df45..cb6fe16a 100644 --- a/src/Map.js +++ b/src/Map.js @@ -45,7 +45,8 @@ module.exports = React.createClass({ getInitialState () { return { - _initialized: false + /* [null, false, true] => ["init", "api loaded", "done"] */ + _initialized: null, }; }, @@ -57,6 +58,14 @@ module.exports = React.createClass({ ensure_map_created(this, this.add_listeners, create_map); }, + componentWillReceiveProps (nextProps, nextContext) { + if (null == this.state._initialized && nextContext.getApi()) { + this.setState({ + _initialized: false, + }); + } + }, + componentWillUpdate () { ensure_map_created(this, this.clear_listeners); },