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-11722 Add uiForwardRef #612

Merged
merged 30 commits into from
Aug 7, 2020

Conversation

joebingham-wk
Copy link
Contributor

@joebingham-wk joebingham-wk commented Jul 29, 2020

Motivation

When planning function components, we missed a couple cases:

Changes

API Changes:

  • Add uiForwardRef
  • Update ref example to include different syntax examples
  • Refactor forwardRef tests to be able to share test coverage with uiForwardRef
  • Add uiForwardRef tests

Builder Changes:

  • Rename FunctionComponentConfig to UiFactoryConfig
  • Rename / refactor isFunctionComponentFactory to shouldGenerateConfig
  • Create a getter on Identifier that can be used to check if the name is a factory type
  • Switch out a couple checks on the identifier name with checks for the presence of a generated UiFactoryConfig

Release Notes

Review

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

Please review:

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed
    • Steps from PR author:
      • QA that the refs print correctly in the example. Note that the components do have code around logging, but that's to keep some consistency between React's docs and our examples. Because there aren't any props updated, there isn't any re-rendering and no reason for the components to log.
    • 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

@aviary2-wf
Copy link

aviary2-wf commented Jul 29, 2020

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.

@@ -707,7 +707,7 @@ main() {
(props) {
return Dom.div()();
},
$BarPropsMixinConfig, // ignore: undefined_identifier
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems like it should have been $BarConfig from the get go - my parser change use the name to detect that it's a generated config and therefore enforces the naming pattern ${FactoryName}Config. Let me know if this doesn't work, though!

@@ -1665,7 +1665,7 @@ main() {
(props) {
return Dom.div()();
},
\$FooConfig, // ignore: undefined_identifier
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems like it should have been $BarConfig from the get go - my parser change use the name to detect that it's a generated config and therefore enforces the naming pattern ${FactoryName}Config. Let me know if this doesn't work, though!

@joebingham-wk joebingham-wk force-pushed the CPLAT-11722-add-uiForwardRef branch from b8f4969 to 7d288eb Compare August 5, 2020 16:49
@@ -253,16 +253,6 @@ extension on SourceSpan {
SourceRange asRangeOrEmpty() => this == null ? SourceRange.EMPTY : asRange();
}

extension<E> on Iterable<E> {
void forEachIndexed(void Function(E, int) callback) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new analyzer version made improvements to the analysis of extensions and caught this was unused

lib/src/builder/parsing/ast_util.dart Outdated Show resolved Hide resolved
lib/src/builder/parsing/ast_util.dart Outdated Show resolved Hide resolved
web/component2/src/demos/ref.dart Outdated Show resolved Hide resolved
@smaifullerton-wk
Copy link
Contributor

talked to Joe about some puzzling things I found while QAing and he's going to take a look -

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 formatting and one minor thing

web/component2/src/demos/ref.dart Outdated Show resolved Hide resolved
web/component2/src/demos/ref.dart Outdated Show resolved Hide resolved
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.

+1

@smaifullerton-wk
Copy link
Contributor

smaifullerton-wk commented Aug 7, 2020

QA +1

tested functionality in demos/ref.dart:

  • button ref forwarded to function component HTML is printed when button is clicked
  • button ref forwarded to higher order component HTML is printed when button is clicked
  • input element ref from class wrapped w/ uiForwardRef using asForwardRefConfig input value is printed
  • input element ref from class wrapped w/ uiForwardRef and generated config using custom props input value & custom prop are printed
  • deprecated forwardRef examples function as expected

@smaifullerton-wk
Copy link
Contributor

QA +1 still stands - latest commit is a wording change only

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

@Workiva/release-management-pp

Copy link

@rmconsole-wf rmconsole-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 from RM

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.

8 participants