diff options
Diffstat (limited to 'src/web/js/components')
-rw-r--r-- | src/web/js/components/MiddlePanel.react.js | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js index 51d582c0..c5a9c3f9 100644 --- a/src/web/js/components/MiddlePanel.react.js +++ b/src/web/js/components/MiddlePanel.react.js @@ -50,10 +50,8 @@ var TableLine = React.createClass({ }); var TableBody = React.createClass({ - propTypes: {articles: React.PropTypes.array.isRequired, - }, getInitialState: function() { - return {articles: this.props.articles, + return {articles: [], }; }, render: function() { @@ -73,19 +71,6 @@ var TableBody = React.createClass({ </table> </div> ); - } -}); - -var MiddlePanel = React.createClass({ - getInitialState: function() { - return {articles: []}; - }, - render: function() { - var body = null; - if(this.state.articles.length) { - body = (<TableBody articles={this.state.articles} />); - } - return (<div className="col-md-offset-2 col-md-10 main">{body}</div>); }, componentDidMount: function() { MiddlePanelActions.reload(); @@ -95,8 +80,16 @@ var MiddlePanel = React.createClass({ MiddlePanelStore.removeChangeListener(this._onChange); }, _onChange: function() { - var datas = MiddlePanelStore.getAll(); - this.setState({articles: datas.articles}); + this.setState({articles: MiddlePanelStore.getArticles()}); + }, +}); + +var MiddlePanel = React.createClass({ + render: function() { + return (<div className="col-md-offset-2 col-md-10 main"> + <TableBody /> + </div> + ); }, }); |