-
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-11977 Consume/update typing for forwardRef2/memo2 functions #620
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
@@ -31,21 +30,12 @@ class FancyInputApi { | |||
FancyInputApi(this.focus); | |||
} | |||
|
|||
UiFactory<FancyInputProps> FancyInput = uiForwardRef((props, ref) { |
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 simplified this while i was in here fixing the typing on forwardedRef
@@ -470,7 +470,7 @@ void useLayoutEffect(dynamic Function() sideEffect, [List<Object> dependencies]) | |||
/// ``` | |||
/// | |||
/// Learn more: <https://reactjs.org/docs/hooks-reference.html#useimperativehandle>. | |||
void useImperativeHandle(Ref ref, dynamic Function() createHandle, [List<dynamic> dependencies]) => | |||
void useImperativeHandle(dynamic ref, dynamic Function() createHandle, [List<dynamic> dependencies]) => |
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.
This has just been updated to match the typing of the react-dart version
expect(getProperty(getProperty(vDomElement.type, 'render'), 'displayName'), 'Anonymous'); | ||
expect(getProperty(getProperty(vDomElement.type, 'render'), 'name'), ''); |
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.
- forwardRef2 uses
name
, notdisplayName
- An empty string is used instead of
Anonymous
inforwardRef2
(the empty string shows up as "Anonymous" in the dev tools, so functionality is equivalent), so these needed to be updated
factory = react_interop.forwardRef(_uiFunctionWrapper); | ||
} | ||
// Always pass displayName, even if it's empty, | ||
// since we don't want forwardRef2 to use _uiFunctionWrapper as the name. |
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.
Under the hood forwardRef2 falls back to the name of the function if displayName
is null, as opposed to the old default of Anonymous
.
If the name is empty, it will still show up as "Anonymous" in the dev tools, so functionality is equivalent.
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
QA+1
|
This is ready for review/QA refresh and merge! @aaronlademann-wf @sydneyjodon-wk |
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
QA+1 |
@Workiva/release-management-p |
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
@Workiva/release-management-pp
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
Workiva/react-dart#275 fixes forwardRef/memo bugs and exposes new versions of the APIs, and we need to consume them in over_react.
Changes
uiForwardRef
to useforwardRef2
under the hoodmemo
to usememo2
under the hoodRelease Notes
Fix
uiForwardRef
andmemo
being passed JSified versions of props.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: