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: prop headerRender should be optional for component Calendar #17063

Merged
merged 1 commit into from Jun 21, 2019

Conversation

wonderjar
Copy link
Contributor

馃 This is a ...

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

馃懟 What's the background?

In Release 13.19.0, new prop headerRender is added for component Calendar(#16535 ), but the ts definition define it mandatory. It's designed as optional in fact.

馃挕 Solution

馃摑 Changelog

Language Changelog
馃嚭馃嚫 English
馃嚚馃嚦 Chinese

鈽戯笍 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

@netlify
Copy link

netlify bot commented Jun 12, 2019

Deploy preview for ant-design ready!

Built with commit 180ed01

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

@codecov
Copy link

codecov bot commented Jun 12, 2019

Codecov Report

Merging #17063 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17063      +/-   ##
==========================================
- Coverage      96%   95.96%   -0.05%     
==========================================
  Files         263      263              
  Lines        7340     7340              
  Branches     2009     2050      +41     
==========================================
- Hits         7047     7044       -3     
- Misses        291      294       +3     
  Partials        2        2
Impacted Files Coverage 螖
components/calendar/index.tsx 96.73% <酶> (酶) 猬嗭笍
components/calendar/Header.tsx 96.84% <100%> (酶) 猬嗭笍
components/_util/wave.tsx 85.84% <0%> (-2.84%) 猬囷笍

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 798d050...180ed01. Read the comment docs.

@@ -178,8 +180,8 @@ export default class Header extends React.Component<HeaderProps, any> {
);
};

headerRenderCustom = (): React.ReactNode => {
const { headerRender, type, onValueChange, value } = this.props;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change here because
const { headerRender, type, onValueChange, value } = this.props;
Type of headerRender is HeaderRender | undefined

If I pass headerRender as function argument, because the func is called by
headerRender ? this.headerRenderCustom(headerRender) : (...)
the type of headerRender is HeaderRender

I just want to avoid the repeated undefined check in TS

@afc163 afc163 merged commit ce04af8 into ant-design:master Jun 21, 2019
@afc163 afc163 mentioned this pull request Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants