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

FED-279: Add improved prop forwarding method #829

Merged
merged 34 commits into from
Aug 14, 2023
Merged

Conversation

kealjones-wk
Copy link
Contributor

@kealjones-wk kealjones-wk commented Jul 19, 2023

Motivation

OverReact's prop forwarding story (fka "Consumed Props") for uiFunction (and UiComponent2) feels overly verbose and tedious. It also just doesn't really match the ease that comes with traditional React prop forwarding via destructuring and spread syntax in JSX, eg. ...rest.

Changes

  • Added two new extension methods to UiProps
    • getPropsToForward for use with addAll (ex. ..addAll(props.getPropsToForward(exclude: {FooPropsMixin})))
    • addPropsToForward for use with modifyProps (ex. ..modifyProps(props.addPropsToForward(exclude: {FooPropsMixin})))
      • exclude named argument will remove the props belonging to that Set of props mixins from the forwarded props.
      • domOnly named argument to forward only DOM based props.

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

Merge Checklist

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

  • A Frontend Frameworks Design 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

aviary-wf commented Jul 19, 2023

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.

@kealjones-wk kealjones-wk marked this pull request as ready for review July 26, 2023 22:29
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.

Made some comments but generally this looks great to me!

@kealjones-wk Were you still planning on updating existing documentation on prop forwarding to recommend this new pattern? Also, would you making sure the PR description is up to date? (it still mentions include)

@@ -23,18 +23,18 @@ _Preview of new boilerplate:_

## Background

While converting the boilerplate for OverReact component declaration from Dart 1
Copy link
Contributor Author

@kealjones-wk kealjones-wk Aug 10, 2023

Choose a reason for hiding this comment

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

Sorry my IDE decided to "fix weird line terminations" or something?
Screenshot 2023-08-10 at 12 54 19 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apparently i cant even undo it now....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eyyy TextEdit to the rescue!

@@ -781,42 +781,117 @@ UiFactory<FooProps> Foo = uiFunction(
);
```

#### With Consumed Props
#### With Prop Forwarding (fka Consumed Props)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this should go somewhere else? ugh i hate deciding where docs should go! @joebingham-wk i need your help lol

Copy link
Contributor

Choose a reason for hiding this comment

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

I think here and in the doc/props_mixin_component_composition.md section is sufficient for this PR 👍

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.

Not sure if this is ready for another full round of review, but I skimmed the docs changes and they look good to me, and I spotted a couple other things

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!

Gonna see if anyone else on the team wants to weigh in before we merge

kealjones-wk and others added 2 commits August 14, 2023 10:32
…s/new_boilerplate/function_component_test.dart

Co-authored-by: Greg Littlefield <[email protected]>
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 refresh

@kealjones-wk
Copy link
Contributor Author

@Workiva/release-management-p

@kealjones-wk
Copy link
Contributor Author

@Workiva/release-management-p

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

@rm-astro-wf rm-astro-wf merged commit 977b4d6 into master Aug 14, 2023
7 checks passed
@rm-astro-wf rm-astro-wf deleted the unused_props branch August 14, 2023 18:18
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.

7 participants