Explorar o código

add componentDidMount

zahmis %!s(int64=5) %!d(string=hai) anos
pai
achega
a1b73149f8
Modificáronse 1 ficheiros con 4 adicións e 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() {