-
Notifications
You must be signed in to change notification settings - Fork 7
FED-1919 Codemod to add required flux actions / store prop(s) #268
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-1919 Codemod to add required flux actions / store prop(s) #268
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
to make this easier to read through / understand codemod flow
|
|
||
| bool _isFnComponentDeclaration(Expression? varInitializer) => | ||
| varInitializer is MethodInvocation && | ||
| varInitializer.methodName.name.startsWith('uiF'); |
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.
Should account for both uiFunction and uiForwardRef
| node.initializer != null && | ||
| node.initializer is SimpleStringLiteral) { | ||
| SimpleStringLiteral literal = node.initializer as SimpleStringLiteral; | ||
| SimpleStringLiteral literal = node.initializer! as SimpleStringLiteral; |
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 were lints causing CI failures in a few misc. files that are unrelated to the scope of this PR.
greglittlefield-wf
left a comment
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.
Made a pass at everything except tests; will take a look at those after lunch
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
greglittlefield-wf
left a comment
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.
Done with second pass, just a couple small comments on tests; overall looks great!
test/dart3_suggestors/null_safety_prep/required_flux_props_test.dart
Outdated
Show resolved
Hide resolved
test/dart3_suggestors/null_safety_prep/required_flux_props_test.dart
Outdated
Show resolved
Hide resolved
Better support for function params and class fields
greglittlefield-wf
left a comment
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.
+1 with some #nits
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
greglittlefield-wf
left a comment
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.
Couple more comments after reviewing the test batch
lib/src/dart3_suggestors/null_safety_prep/required_flux_props.dart
Outdated
Show resolved
Hide resolved
by always setting missing stores to null See: #268 (comment)
greglittlefield-wf
left a comment
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.
+10
|
@Workiva/release-management-p |
rmconsole-wf
left a comment
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.
+1 from RM
Motivation
The null safety over_react major release will make a breaking change in which
FluxPropsMixin'sstoreandactionsprops are required, so that they can be made non-nullable.Making
storerequired shouldn't affect most usages, butactionswill definitely affect some consumers.While the
actionsprop will be present in usages in most cases, there are usages that only wire up a component to redraw on the store, because the actions aren't used.Changes
RequiredFluxProps()codemod class that patches invoked and un-invoked builders that mix-inFluxUiPropsMixinwhen either theactionsorstoreprop(s) are missing.nullvalue unless an in-scope var with matching type is found.QA