Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Refactor Menu related components life cycle methods #15868

Merged
merged 9 commits into from Apr 5, 2019

Conversation

Projects
None yet
4 participants
@zombieJ
Copy link
Member

commented Apr 4, 2019

馃 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

馃懟 What's the background?

ref #15801
(Related issue should close with confriming one by one after this code merge)

close #15800
close #15797
close #15717
close #15776
close #15819
close #15853
close #15849
close #15858

馃挕 Solution

Refactor Menu related components life cycle methods

馃摑 Changelog

Fix Menu shaking & collapse behavior.

鈽戯笍 Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

cc @zy410419243

zombieJ added some commits Apr 4, 2019

@zombieJ zombieJ requested review from afc163 and ztplz Apr 4, 2019

@netlify

This comment has been minimized.

Copy link

commented Apr 4, 2019

Deploy preview for ant-design ready!

Built with commit 2d668d9

https://deploy-preview-15868--ant-design.netlify.com

@afc163

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

https://deploy-preview-15868--ant-design.netlify.com/components/menu-cn/#components-menu-demo-inline-collapsed 杩欎釜渚嬪瓙琛ㄧ幇鏄敊鐨勩

鍙﹀琛ヤ竴浜涚敤渚嬶紵

@ztplz

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

鏈夊繀瑕佺敤context鍚 鐢╬rops浼犱笉濂藉悧
鐪嬩簡涓涓 杩欐牱鏀 灏辨槸寮鸿璺熶互鍓嶉昏緫涓鏍蜂簡

class Sider extends React.Component<SiderProps, SiderState> {
static __ANT_LAYOUT_SIDER: any = true;

class InternalSider extends React.Component<InternalSideProps, SiderState> {
static defaultProps = {

This comment has been minimized.

Copy link
@zy410419243

zy410419243 Apr 4, 2019

Contributor

杩 defaultProps 杩樻槸鍒犱簡鍚э紝鐗瑰埆鏄 getDerivedStateFromProps 閲屼細鎺ユ敹 collapsed锛屽緢鎬曞嚭闂鍙堟壘涓嶇潃鍘熷洜

This comment has been minimized.

Copy link
@zombieJ

zombieJ Apr 4, 2019

Author Member

defaultProps 鍙湁涓 defaultCollapsed锛屼笉鎷呭績鍝垀

title:
zh-CN: 鑷畾涔夎Е鍙戝櫒
en-US: Custom trigger
debug: true

This comment has been minimized.

Copy link
@zy410419243

zy410419243 Apr 4, 2019

Contributor

杩欓噷鍒繕浜嗘敼鍥炴潵

This comment has been minimized.

Copy link
@zombieJ

zombieJ Apr 4, 2019

Author Member

杩欎釜鏄 debug 鏂囦欢锛岀敤鎴蜂笉鐢ㄥ叧娉ㄧ殑銆

export interface SiderState {
collapsed?: boolean;

This comment has been minimized.

Copy link
@zy410419243

zy410419243 Apr 4, 2019

Contributor

杩欓噷鐨勬敼鍔ㄨ矊浼兼病鍟ュソ澶勶紝鍙嶈岄渶瑕佸湪鏋勯犲櫒閲屽缁欎釜鍊硷紵

This comment has been minimized.

Copy link
@zombieJ

zombieJ Apr 4, 2019

Author Member

鍡紝鏄簲璇ラ粯璁ゅ彲閫夈傛敼鎴愬繀椤诲弽鑰屽嚭浜 BUG銆

@@ -257,7 +262,8 @@ class Menu extends React.Component<MenuProps, MenuState> {
}

renderMenu = ({ getPopupContainer, getPrefixCls }: ConfigConsumerProps) => {
const { prefixCls: customizePrefixCls, className, theme } = this.props;
const { prefixCls: customizePrefixCls, className, theme, collapsedWidth } = this.props;
const passProps = omit(this.props, ['collapsedWidth']);

This comment has been minimized.

Copy link
@zy410419243

zy410419243 Apr 4, 2019

Contributor

杩欓噷鍙互琛ヤ笂 siderCollapsed锛岀幇鍦ㄦ湁 React does not recognize 鐨 warning

@zy410419243

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2019

鏃堕棿涓嶅鐨勮瘽锛岄昏緫杩樻槸鐓т互鍓嶆潵濂姐侻enu 鏈夌偣绁栦紶浠g爜鐨勫懗閬撲簡锛屽姩涓涓嬪氨浼氭锛岀敤渚嬫病瑕嗙洊鍒扮殑鍦版柟涓鏀瑰姩锛屽氨浼氬儚鎴戣繖鏍疯鈥滃墠濂冲弸鈥濈洴濂戒箙...

@@ -68,9 +76,7 @@ const generateId = (() => {
};
})();

class Sider extends React.Component<SiderProps, SiderState> {
static __ANT_LAYOUT_SIDER: any = true;

This comment has been minimized.

Copy link
@zy410419243

zy410419243 Apr 4, 2019

Contributor

杩欑帺鎰忔槸鏈璁╂垜璐硅В鐨勶紝涓嶇煡閬撳湪鍝敤鍒帮紝浣嗗垹浜嗗ソ鍍忓氨璺戜笉杩囨祴璇曪紝灏卞緢鎬

This comment has been minimized.

Copy link
@zombieJ

zombieJ Apr 4, 2019

Author Member

鐪嬭捣鏉ュソ鍍忔槸娌$敤浜嗭紝鎴戝垹浜嗚瘯璇曘

This comment has been minimized.

Copy link
@afc163

afc163 Apr 4, 2019

Member

瀵癸紝涓嶉渶瑕佷簡 cad769a

zombieJ added some commits Apr 4, 2019

@zombieJ

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2019

鏈夊繀瑕佺敤context鍚 鐢╬rops浼犱笉濂藉悧
鐪嬩簡涓涓 杩欐牱鏀 灏辨槸寮鸿璺熶互鍓嶉昏緫涓鏍蜂簡

鐩存帴浼犲氨鍙樻垚 React.cloneElement锛岃繖鏍峰弽鑰屼笉濡 context銆傝屼笖濡傛灉鐢ㄦ埛鑷繁鍖呬簡涓涓 HOC 灏辨寕浜嗐

zombieJ added some commits Apr 4, 2019

@codecov

This comment has been minimized.

Copy link

commented Apr 4, 2019

Codecov Report

Merging #15868 into master will decrease coverage by 0.01%.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15868      +/-   ##
==========================================
- Coverage   95.06%   95.05%   -0.02%     
==========================================
  Files         251      251              
  Lines        6667     6671       +4     
  Branches     1947     1949       +2     
==========================================
+ Hits         6338     6341       +3     
- Misses        328      329       +1     
  Partials        1        1
Impacted Files Coverage 螖
components/menu/SubMenu.tsx 75% <100%> (酶) 猬嗭笍
components/menu/index.tsx 97.29% <100%> (酶) 猬嗭笍
components/layout/layout.tsx 88.57% <63.63%> (-2.06%) 猬囷笍
components/layout/Sider.tsx 90% <85.71%> (+0.46%) 猬嗭笍
components/time-picker/index.tsx 98.59% <0%> (-0.06%) 猬囷笍
components/empty/index.tsx 94.73% <0%> (酶) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 3c75c4f...2d668d9. Read the comment docs.

zombieJ added some commits Apr 4, 2019

@zombieJ

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2019

Updated. Please check.

@afc163

afc163 approved these changes Apr 5, 2019

@zombieJ zombieJ merged commit 89dd827 into master Apr 5, 2019

26 of 29 checks passed

codebeat 7 issues resolved and 8 introduced
Details
Header rules No header rules processed
Details
Pages changed 12 new files uploaded
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
CodeFactor 1 issue fixed. 1 issue found.
Details
LGTM analysis: JavaScript No new or fixed alerts
Details
License Compliance All checks passed.
Details
Mixed content No mixed content detected
Details
Redirect rules 18 redirect rules processed
Details
Semantic Pull Request ready to be squashed
Details
WIP Ready for review
Details
ant-design.ant-design #ant design succeeded
Details
buildsize No change
Details
ci/circleci: compile Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test_dist Your tests passed on CircleCI!
Details
ci/circleci: test_dist_15 Your tests passed on CircleCI!
Details
ci/circleci: test_dom Your tests passed on CircleCI!
Details
ci/circleci: test_dom_15 Your tests passed on CircleCI!
Details
ci/circleci: test_es Your tests passed on CircleCI!
Details
ci/circleci: test_es_15 Your tests passed on CircleCI!
Details
ci/circleci: test_lib Your tests passed on CircleCI!
Details
ci/circleci: test_lib_15 Your tests passed on CircleCI!
Details
ci/circleci: test_node Your tests passed on CircleCI!
Details
ci/circleci: test_node_15 Your tests passed on CircleCI!
Details
deploy/netlify Deploy preview ready!
Details
security/snyk - package.json (paranoidjk) No manifest changes detected

@delete-merged-branch delete-merged-branch bot deleted the fix-menu branch Apr 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.