Explorar el Código

add componentDidMount

zahmis hace 5 años
padre
commit
a1b73149f8
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/client/js/components/PageTimeline.jsx

+ 4 - 2
src/client/js/components/PageTimeline.jsx

@@ -33,7 +33,7 @@ class PageTimeline extends React.Component {
   async handlePage(selectedPage) {
     const { appContainer, pageContainer } = this.props;
     const { path } = pageContainer.state;
-    const limit = this.state.limit;
+    const { limit } = this.state;
     const offset = (selectedPage - 1) * limit;
 
     // if (!path) { return null }
@@ -55,8 +55,10 @@ class PageTimeline extends React.Component {
 
     // initialize GrowiRenderer
     this.growiRenderer = appContainer.getRenderer('timeline');
-    this.handlePage(1);
+  }
 
+  async componentDidMount() {
+    await this.handlePage(1);
   }
 
   render() {