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

CPLAT-5211 Add @Component2 annotation #289

Merged
merged 12 commits into from
May 2, 2019

Conversation

aaronlademann-wf
Copy link
Contributor

@aaronlademann-wf aaronlademann-wf commented May 1, 2019

Motivation

Since #280 modified the builder to no longer utilize fully-resolved AST when parsing annotations / component declarations, we must update the builder for our React 16 / over_react 3.1.0 work to differentiate UiComponent2 instances without traversing the class hierarchy to tell if a component extends another component class that extends Component2.

We need to know if it is a "v2" component instance so we can modify the generated boilerplate to utilize JS-backed maps instead of the Dart maps that V1 components rely on.

Changes

  • Deprecate the @Component / @AbstractComponent annotations
  • Add @Component2 / @AbstractComponent2 annotations
  • Update the builder's declaration parsing logic to differentiate "v2" components using the new @Component2 annotation instead of fully-resolved AST
  • Add / update tests

Boy Scoutin'

  • Deprecate UiComponent / UiStatefulComponent
  • Add missing doc comments for UiComponent2 / UiStatefulComponent2
  • Replace usage of old react-dart js-interop helpers with the stuff available in dart:js_util

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

Please review: @greglittlefield-wf @joebingham-wk @kealjones-wk @evanweible-wf

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • All tests pass in Dart 2
  • Manual testing was performed if needed
    • Steps from PR author:
      • Serve the example components playground page and verify that they all utilize JS-backed maps as a result of them now using the @Component2 annotation.
    • Anything falling under manual testing criteria outlined in CONTRIBUTING.md

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Client Platform member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@aviary-wf
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 Slack: #support-infosec.

@aaronlademann-wf aaronlademann-wf changed the title CPLAT-5211 Add @Componen2 annotation CPLAT-5211 Add @Component2 annotation May 1, 2019
@aaronlademann-wf aaronlademann-wf changed the base branch from 3.0.0-wip to 3.1.0-wip May 1, 2019 18:47
@aaronlademann-wf aaronlademann-wf added this to the 3.1.0 milestone May 1, 2019
# Conflicts:
#	lib/src/util/react_wrappers.dart
#	pubspec.yaml
+ Without the use of fully-resolved AST since we no longer have access to it for build perf reasons (see: #280)
+ Resulting from rebasing the new 3.1.0-wip branch
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.

+10

These changes look perfect, @aaronlademann-wf; nice job!!

@@ -477,18 +537,21 @@ class ParsedDeclarations {
final bool declaresComponent;

/// Helper function that returns the single value of a [list], or null if it is empty.
static dynamic singleOrNull(List list) => list.isNotEmpty ? list.single : null;
static singleOrNull(List list) => list.isNotEmpty ? list.single : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

#nit Ooh we could make this generic (generics functions weren't supported when this method was authored):

Suggested change
static singleOrNull(List list) => list.isNotEmpty ? list.single : null;
static T singleOrNull<T>(List<T> list) => list.isNotEmpty ? list.single : null;

@aaronlademann-wf
Copy link
Contributor Author

+1 to 6856a62

@Workiva/release-management-pp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants