-
Notifications
You must be signed in to change notification settings - Fork 58
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-1717 Finalize null-safe props/state implementation and utilities, add tests #869
Conversation
…BoundaryPropsMapView
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of generated file diffs in this PR with just the $getPropKey
changes.
If you'd like to hide them when reviewing this PR to cut down on noise:
- Scroll down to the bottom of the
/files
page to trigger all files to load - Run the following snippet in the console to hide files ending in
.over_react.g.dart
:document.querySelectorAll('[data-tagsearch-path$=".over_react.g.dart"]') .forEach((e) => e.hidden = true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these null_safe_accessor_integration_test.dart
tests should be the same, except for the component boilerplate.
component_base.UiProps { | ||
UiProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing the generated UiProps makes it so that we can use @override
in the methods we're overriding below; not sure why we weren't always doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of questions.
Way to put a bow on this Greg!!!
...component_declaration/builder_integration_tests/new_boilerplate/function_component_test.dart
Outdated
Show resolved
Hide resolved
|
||
test('the late keyword and the requiredProp annotation', () { | ||
var body = '''@requiredProp | ||
late var bar;'''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm imagining this trendy new club in old town... called the var bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its open late.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a pretty great name 😂
Its open late.
Lolol 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA +1
- Passing CI
Motivation
The WIP branch had a mostly-complete implementation of null-safe props and state, but it needed to be finished up and tested.
We also needed to implement utilities for safely reading required non-nullable props from partial props objects.
Changes
late
props@Accessor
annotationgetRequiredProp
andgetRequiredPropOrNull
, for safely reading required non-nullable props when they might not be specifiedgetPropKey
andcontainsProp
, required for implementinggetRequiredProp
$getPropKey
(used bygetPropKey
, needed for utilities above) for all props classes$getPropKey
to non-generated classes, with a special case forUiPropsMapView
(see breaking changes note)late
and legacy required prop annotations$getPropKey
:UiPropsMapView
,DomProps
,SvgProps
,GenericUiProps
,ProviderProps
,ConsumerProps
Breaking changes
UiPropsMapView
(which has been deprecated for a while now) is now abstract and requires subclasses to overrideselfFactory
, in order for it to be able to implement$getPropKey
ProviderProps.props
widened fromJsMap
toMap
- this seemed to be an oversight in the implementation, and this typing prevented it from implementing$getPropKey
. I wouldn't expect this to impact consumers.Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: