scup / atellier

The smartest way to share interactive components with your team.
http://scup.github.io/atellier/
MIT License
995 stars 33 forks source link

Closing the props pane triggers "Uncaught TypeError: Cannot set property 'indexKey' of null" #47

Open sompylasar opened 8 years ago

sompylasar commented 8 years ago

The issue is that Atellier's _handleSelectComponent method assumes there's always a component to select, but in case of handling the Workspace's onCloseProperties it's null.

https://github.com/scup/atellier/blob/5ad6a401d78b5625eb5293891b4741aad0149788/src/Atellier.js#L39

  _handleSelectComponent = (component, key) => {
    component.indexKey = key;
    this.setState({stagedComponent: component});
  };

https://github.com/scup/atellier/blob/5ad6a401d78b5625eb5293891b4741aad0149788/src/Atellier.js#L34

<Workspace components={components} component={stagedComponent} onCloseProperties={this._handleSelectComponent} />

https://github.com/scup/atellier/blob/5ad6a401d78b5625eb5293891b4741aad0149788/src/PropertiesContainer.js#L147

  _handleCloseProperties = () => {
    return this.props.onCloseProperties && this.props.onCloseProperties(null);
  };