@@ -7,13 +7,16 @@ import MainContainer from './MainContainer.jsx';
77import RightContainer from './RightContainer.jsx' ;
88import convertIdToObjs from '../utils/convertIdsToObjs.util' ;
99import theme from '../components/theme' ;
10+ import { loadInitData } from '../actions/components' ;
1011
1112const mapStateToProps = store => ( {
1213 components : store . workspace . components ,
1314 totalComponents : store . workspace . totalComponents ,
1415 focusComponent : store . workspace . focusComponent ,
1516} ) ;
1617
18+ const mapDispatchToProps = { loadInitData } ;
19+
1720class AppContainer extends Component {
1821 state = {
1922 width : 25 ,
@@ -34,6 +37,10 @@ class AppContainer extends Component {
3437 }
3538 }
3639
40+ componentDidMount ( ) {
41+ this . props . loadInitData ( ) ;
42+ }
43+
3744 render ( ) {
3845 const { components, totalComponents, focusComponent } = this . props ;
3946 const { width, rightColumnOpen } = this . state ;
@@ -66,10 +73,11 @@ class AppContainer extends Component {
6673 }
6774}
6875
69- export default connect ( mapStateToProps ) ( AppContainer ) ;
76+ export default connect ( mapStateToProps , mapDispatchToProps ) ( AppContainer ) ;
7077
7178AppContainer . propTypes = {
7279 components : PropTypes . array . isRequired ,
7380 totalComponents : PropTypes . number . isRequired ,
7481 focusComponent : PropTypes . object . isRequired ,
82+ loadInitData : PropTypes . func . isRequired ,
7583} ;
0 commit comments