From c1e9122b7ccf8bd2ddb5d8198ce71e537a9e35ff Mon Sep 17 00:00:00 2001 From: jim Date: Fri, 1 Jun 2018 14:44:54 +0800 Subject: [PATCH] fix #1561 fix getDerivedStateFromProps bug --- package.json | 7 ++-- src/components/Login/LoginTab.js | 9 +++-- src/components/Login/index.js | 2 +- src/components/SiderMenu/SiderMenu.js | 2 +- src/components/TopNavHeader/index.js | 2 +- src/e2e/home.e2e.js | 2 +- src/routes/Forms/TableForm.js | 49 ++++++++++++++++++++------- 7 files changed, 52 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 2e44151a..541c7152 100755 --- a/package.json +++ b/package.json @@ -5,9 +5,10 @@ "private": true, "scripts": { "precommit": "npm run lint-staged", - "start": "cross-env ESLINT=none roadhog dev", + "start": "HARD_SOURCE=none cross-env ESLINT=none roadhog dev", "start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev", "build": "cross-env ESLINT=none roadhog build", + "build-site": "roadhog-api-doc static", "site": "roadhog-api-doc static && gh-pages -d dist", "analyze": "cross-env ANALYZE=true roadhog build", "lint:style": "stylelint \"src/**/*.less\" --syntax less", @@ -40,10 +41,10 @@ "prop-types": "^15.5.10", "qs": "^6.5.0", "rc-drawer-menu": "^1.1.0", - "react": "^16.3.1", + "react": "^16.4.0", "react-container-query": "^0.11.0", "react-document-title": "^2.0.3", - "react-dom": "^16.3.1", + "react-dom": "^16.4.0", "react-fittext": "^1.0.0", "rollbar": "^2.3.4", "url-polyfill": "^1.0.10" diff --git a/src/components/Login/LoginTab.js b/src/components/Login/LoginTab.js index 30e84ccb..ea42fc8e 100644 --- a/src/components/Login/LoginTab.js +++ b/src/components/Login/LoginTab.js @@ -21,15 +21,20 @@ class LoginTab extends Component { this.props.tabUtil.addTab(this.uniqueId); } render() { - return ; + return {this.props.children}; } } const warpContext = props => { return ( - {value => } + {value => { + return ; + }} ); }; +// 标志位 用来判断是不是自定义组件 +warpContext.typeName = 'LoginTab'; + export default warpContext; diff --git a/src/components/Login/index.js b/src/components/Login/index.js index 686358e0..702c13f1 100644 --- a/src/components/Login/index.js +++ b/src/components/Login/index.js @@ -78,7 +78,7 @@ class Login extends Component { return; } // eslint-disable-next-line - if (item.type.name === 'warpContext') { + if (item.type.typeName === 'LoginTab') { TabChildren.push(item); } else { otherChildren.push(item); diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 830db64f..6d64a4a3 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -233,7 +233,7 @@ export default class SiderMenu extends PureComponent { width={256} className={`${styles.sider} ${theme === 'light' ? styles.light : ''}`} > -
+