-
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
CPLAT-5909 Update error boundary component to use the init method #300
Conversation
Cast Map being passed into the state setter to a JsBackedMap
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
@@ -247,6 +247,9 @@ class ImplGenerator { | |||
..writeln() | |||
..writeln(' @override') | |||
..writeln(' set state(Map value) {') | |||
..writeln(' assert(value is JsBackedMap, ') | |||
..writeln(' \'Component2.state may only be set to a JsBackedMap, \'') | |||
..writeln(' \'and must not be set outside of the react-dart internals.\');') |
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.
Can we make this message for helpful to the consumer by instructing them to use the initializeState
method instead?
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.
Yep, good call. Because it's the general state setter I updated the message to also mention setState. Let me know if the new message could be improved as well!
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.
@joebingham-wk this is looking good, but the build is failing.
This is because your changes are dependent on Workiva/react-dart#187, but the dependency override has not been updated to reflect that in pubspec.yaml
.
You were correct to point out the dependency in your PR description, and to place the Hold
label. However, when working on PRs / branches that depend on one another, you should also go ahead and add/update the dependency override within pubspec.yaml
so that we can verify that the build will pass using the changes that are external to this lib.
dependency_overrides:
react:
git:
url: https://github.com/cleandart/react-dart.git
- ref: 5.1.0-wip
+ ref: CPLAT-5908-Add-initializeState
Then, once the CPLAT-5908-Add-initializeState
branch merges into react-dart 5.1.0-wip
, you can switch it back to 5.1.0-wip
. If the PR was not going into an integration branch like this one is, you would just remove the dependency override altogether at that time.
Awesome, that explanation helps a lot. Thank you! |
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
+10 @Workiva/release-management-pp |
Motivation
The
init
lifecycle method was introduced in part to allow for set to be state prior to component mounting. With the current code generation script, the typing conflicts because the generated code expects aJsBackedMap
while react-dart accepts anyMap
. This results in a runtime error.Changes
Map
to aJsBackedMap
.init
method to ensure it behaves the same asgetInitialState
.getInitialState
withinit
withinerror_boundary_mixins.dart
.Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
@aaronlademann-wf @greglittlefield-wf @kealjones-wk
QA Checklist
webdev serve web
init()
lifecycle method.Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: