Эх сурвалжийг харах

修改cannot setstate on a not yet mount component 的报错

xy 7 жил өмнө
parent
commit
05d2d44a88

+ 2 - 1
src/app/common/deploy/Deploy.jsx

@@ -50,6 +50,8 @@ class Deploy extends Component {
         }, this.fetch)
     }
 
+
+
     fetch = () => {
         if (this.state.schemaID !== '' && this.state.schemaID !== undefined) {
             request(graphqlUrl, SHOW_FC_SCHEMA, {schema_id: this.state.schemaID}).then(
@@ -63,7 +65,6 @@ class Deploy extends Component {
                                 request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
                                     __data => {
                                         // 如果 user 未设置 cloudID
-                                        console.log(__data);
                                         if(__data.cloud_by_props.length === 0) {
                                             this.setState({
                                                 tencentFC: false,

+ 3 - 1
src/app/common/deploy/tencent/TencentConfig.js

@@ -25,9 +25,11 @@ class TencentConfig extends Component {
             cloudID: props.cloudID,
             fc: props.fc
         };
-        this.fetch();
     }
 
+    componentDidMount() {
+        this.fetch();
+    }
 
     componentWillReceiveProps(next) {
         this.setState({