-
Notifications
You must be signed in to change notification settings - Fork 67
FED-1910 Fix react_dom API typings, add tests #382
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
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
5b6e052 to
886fb2e
Compare
886fb2e to
d61e63f
Compare
aaronlademann-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
Love the new test coverage!
|
@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 existing nullability/typings for
ReactDom.findDomNodeandReactDom.renderexported frompackage:react/react_client/react_interop.dartare incorrect.findDOMNodereturns null in many cases, but its return type is incorrectly non-nullable.renderreturns null for some cases (function components,null),Elementfor DOM components, andCharacterDatafor strings and numbers, but is incorrectly typed as non-nullableReactComponent. Thecomponentargument also acceptsnulland other "ReactNode" arguments to rendered, but its type is incorrectly non-nullable and restricted to justReactElement.These bad typings cause runtime errors in some cases. Unfortunately, there wasn't good test coverage around these methods.
These typings also only affect these APIs under the
ReactDomclass in package:react/react_client/react_interop.dart, and not the top-levelFunction-typedfindDOMNodeandrenderAPIs exported frompackage:react/react_dom.dart, which most consumers use.Because these typings were incorrect and will lead to runtime errors in some cases, and the changes have a low likelihood of causing breakages, it feels appropriate to release these changes as a patch.
Solution