diff --git a/frontend/src/component/feature/view-edit-container.jsx b/frontend/src/component/feature/view-edit-container.jsx index def1573dc7..76373fad47 100644 --- a/frontend/src/component/feature/view-edit-container.jsx +++ b/frontend/src/component/feature/view-edit-container.jsx @@ -150,7 +150,7 @@ function getHistoryFromToggle (state, toggleName) { if (!toggleName) { return []; } - + if (state.history.hasIn(['toggles', toggleName])) { return state.history .getIn(['toggles', toggleName]) diff --git a/frontend/src/component/history/history-list-container.jsx b/frontend/src/component/history/history-list-container.jsx index df8a725a80..b3055e52e3 100644 --- a/frontend/src/component/history/history-list-container.jsx +++ b/frontend/src/component/history/history-list-container.jsx @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import HistoryListComponent from './history-list-component'; +import HistoryListToggleComponent from './history-list-component'; import { updateSettingForGroup } from '../../store/settings/actions'; const mapStateToProps = (state) => { @@ -12,6 +12,6 @@ const mapStateToProps = (state) => { const HistoryListContainer = connect(mapStateToProps, { updateSetting: updateSettingForGroup('history'), -})(HistoryListComponent); +})(HistoryListToggleComponent); export default HistoryListContainer; diff --git a/frontend/src/component/history/history-list-toggle-component.jsx b/frontend/src/component/history/history-list-toggle-component.jsx index 6ac646ee5f..28ba996613 100644 --- a/frontend/src/component/history/history-list-toggle-component.jsx +++ b/frontend/src/component/history/history-list-toggle-component.jsx @@ -1,17 +1,8 @@ import React, { Component, PropTypes } from 'react'; import ListComponent from './history-list-container'; -import { fetchHistoryForToggle } from '../../data/history-api'; class HistoryListToggle extends Component { - constructor (props) { - super(props); - this.state = { - fetching: true, - history: undefined, - }; - } - static propTypes () { return { toggleName: PropTypes.string.isRequired, @@ -19,21 +10,21 @@ class HistoryListToggle extends Component { } componentDidMount () { - fetchHistoryForToggle(this.props.toggleName) - .then((res) => this.setState({ history: res.events, fetching: false })); + this.props.fetchHistoryForToggle(this.props.toggleName); } render () { - if (this.state.fetching) { + if (!this.props.history || this.props.history.length === 0) { return fetching..; } return (