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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AF-2922: add defaultProps getter to UiProp #196

Merged
merged 3 commits into from
Nov 16, 2018

Conversation

sebastianmalysa-wf
Copy link
Contributor

Ultimate problem:

With the new builder, the implementation of typedPropsFactory() will no longer be available on the component class defined by the consumer – it will only be available on the generated component class. As a consequence, all instances of new FooComponent().getDefaultProps() will break.

How it was fixed:

Add a defaultProps getter on the UiProps as an alternative way to retrieve a component's default props since instantiating the component class directly is an anti-pattern anyway.

Testing suggestions:

  • Code changes and test updates make sense
  • CI Passes

@greglittlefield-wf @corwinsheahan-wf @evanweible-wf

@aviary3-wk
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on HipChat: InfoSec Forum.

@greglittlefield-wf
Copy link
Contributor

+1

Might be good to do a quick check to make sure no one's declaring a defaultProps prop before releasing.

@codecov-io
Copy link

codecov-io commented Oct 29, 2018

Codecov Report

Merging #196 into master will increase coverage by 0.29%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
+ Coverage   94.27%   94.55%   +0.29%     
==========================================
  Files          34       34              
  Lines        1640     1651      +11     
==========================================
+ Hits         1546     1561      +15     
+ Misses         94       90       -4

@sebastianmalysa-wf
Copy link
Contributor Author

@aaronlademann-wf aaronlademann-wf added the dart2 PRs targeting our effort to get to Dart SDK 2.0 compatibility label Nov 6, 2018
Copy link
Contributor

@aaronlademann-wf aaronlademann-wf left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

Just noticed two small things

@@ -690,6 +690,11 @@ abstract class UiProps extends MapBase
}

Function get componentFactory;

Map get componentDefaultProps => componentFactory is ReactDartComponentFactoryProxy
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have a doc comment

Map get componentDefaultProps => componentFactory is ReactDartComponentFactoryProxy
// ignore: avoid_as
? (componentFactory as ReactDartComponentFactoryProxy).defaultProps
: const {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test case for this case?
e.g.,

expect(Dom.div().componentDefaultProps, equals({}));

@corwinsheahan-wf
Copy link
Contributor

QA +1

  • CI Passes
  • Added tests offer coverage of changes
  • Tested with codemod updates in WSD. Works correctly in tandem with codemod changes implemented in WSD.

Merging into master.
@Workiva/release-management-p

@rmconsole4-wk rmconsole4-wk merged commit 53a9246 into Workiva:master Nov 16, 2018
@evanweible-wf evanweible-wf added this to the Dart 2 Compat milestone Dec 21, 2018
@evanweible-wf evanweible-wf modified the milestones: Dart 2 Compat, 2.0.0 (Dart 1 & 2 compatibility) Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart2 PRs targeting our effort to get to Dart SDK 2.0 compatibility Merge Requirements Met RM Ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants