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-9715 Fix accidental jsification of Map/Function Dart props when using connect #461

Merged
merged 2 commits into from
Feb 18, 2020

Conversation

greglittlefield-wf
Copy link
Contributor

Motivation

Wrapping Dart components in connect unexpectedly jsified props, causing Map props to show up as JS Objects when read by the component.

Changes

  • Use a ReactDartComponent2FactoryProxy instead of a JSComponentFactoryProxy, since the connect component really behaves more like a Dart component (see code comment in connect).
  • Add regression test

Release Notes

  • Fix accidental jsification of Map/Function Dart props in certain cases when using connect

Review

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

Please review: @aaronlademann-wf @joebingham-wk @sydneyjodon-wk
FYI: @matthewnitschke-wk @kealjones-wk

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 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

/// without any conversion needed by JS Components, and props are are fed directly
/// into Dart code (e.g., those passed into mapStateToPropsWithOwnProps/areOwnPropsEqual)
/// without needing unwrapping/conversion.
final hocFactoryProxy = ReactDartComponentFactoryProxy2(hoc);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aaronlademann-wf We might want to consider just doing this for forwardRef as well (conditionally if the provided factory is a Dart component), since I think this jsification issue might still exist in react-dart 5.4.0-wip.

@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.

@rmconsole4-wk rmconsole4-wk changed the title Fix accidental jsification of Map/Function Dart props when using connect CPLAT-9715 Fix accidental jsification of Map/Function Dart props when using connect Feb 17, 2020
Copy link
Contributor

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

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

+1


test('without converting the props whatsoever', () {
// Test functions/Maps to ensure they're not allowInterop'd,
// test event handlers to ensure they're not oterwise converted
Copy link
Contributor

Choose a reason for hiding this comment

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

#nit typo

Suggested change
// test event handlers to ensure they're not oterwise converted
// test event handlers to ensure they're not otherwise converted

@matthewnitschke-wk
Copy link
Contributor

QA +1, Verified through https://github.com/Workiva/graph_ui/pull/1058 that the properties correctly get passed through connect as Dart props and not the previous js props

@greglittlefield-wf
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

@rmconsole7-wk rmconsole7-wk merged commit 7390a19 into master Feb 18, 2020
@rmconsole7-wk rmconsole7-wk deleted the connect-NativeJavaScriptObject-fix branch February 18, 2020 21:58
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.

6 participants