Răsfoiți Sursa

fix loginInput setState warning

Csy817 7 ani în urmă
părinte
comite
da6a2ad756

+ 11 - 4
src/app/basicVersion/myDeploy/AliyunDeploy.js

@@ -23,6 +23,7 @@ class TencentDeploy extends Component {
     }
 
     componentWillMount() {
+        this._isMounted = true;
         let {userID} = this.state;
         if (userID !== 'demo') {
             request(graphqlUrl, SHOW_APIGROUP, {userID}).then(res => {
@@ -30,14 +31,20 @@ class TencentDeploy extends Component {
                 let deployed = allDeployed.filter(deployed =>
                     deployed.cloud_id.cloudName === 'aliyun'
                 );
-                this.setState({
-                    deployed,
-                    show: true
-                })
+                if(this._isMounted) {
+                    this.setState({
+                        deployed,
+                        show: true
+                    })
+                }
             })
         }
     }
 
+    componentWillUnmount() {
+        this._isMounted = false;
+    }
+
     render() {
         let {userID, url, deployed, show} = this.state;
         return (

+ 11 - 4
src/app/basicVersion/myDeploy/AmazonDeploy.js

@@ -23,6 +23,7 @@ class TencentDeploy extends Component {
     }
 
     componentWillMount() {
+        this._isMounted = true;
         let {userID} = this.state;
         if (userID !== 'demo') {
             request(graphqlUrl, SHOW_APIGROUP, {userID}).then(res => {
@@ -30,14 +31,20 @@ class TencentDeploy extends Component {
                 let deployed = allDeployed.filter(deployed =>
                     deployed.cloud_id.cloudName === 'amazon'
                 );
-                this.setState({
-                    deployed,
-                    show: true
-                })
+                if(this._isMounted) {
+                    this.setState({
+                        deployed,
+                        show: true
+                    })
+                }
             })
         }
     }
 
+    componentWillUnmount() {
+        this._isMounted = false;
+    }
+
     render() {
         let {userID, url, deployed, show} = this.state;
         return (

+ 1 - 1
src/language/zh_CN.js

@@ -163,7 +163,7 @@ const zh_CN = {
     'My deploy': '我的部署',
     'Communication': '交流',
     'loading': '加载中...',
-    'nothing': '这里什么都没有...',
+    'nothing': '暂无部署...',
     'new': '新!',
     'go to deploy,then see more': '部署以查看更多'
 };