Closed greglittlefield-wf closed 4 years ago
Recommendation: :bangbang: Major version bump (fyi @Workiva/semver-audit-group )
@@ line 37: package:react/react_client/react_interop.dart @@
abstract class React
- static ReactClass memo(dynamic Function(JsMap, [JsMap]) wrapperFunction, [bool Function(JsMap, JsMap) areEqual])
+ static ReactClass memo(dynamic wrapperFunction, [bool Function(JsMap, JsMap) areEqual])
// `type` of `wrapperFunction` has changed.
// Changing a parameter signature is a major change.
@@ line 38: package:react/react.dart @@
+ typedef DartForwardRefFunctionComponent = dynamic Function(JsBackedMap props, dynamic ref)
// Adding a typedef is a minor change.
@@ line 232: package:react/react_client/react_interop.dart @@
+ ReactComponentFactoryProxy forwardRef2(dynamic Function(Map<dynamic, dynamic>, dynamic) wrapperFunction, {String displayName})
// Adding a top-level function is a minor change.
@@ line 232: package:react/react_client/react_interop.dart @@
+ ReactComponentFactoryProxy forwardRef2(dynamic Function(Map<dynamic, dynamic>, dynamic) wrapperFunction, {String displayName})
// Adding a top-level function is a minor change.
@@ line 303: package:react/react_client/react_interop.dart @@
+ ReactComponentFactoryProxy memo2(ReactComponentFactoryProxy factory, {bool Function(Map<dynamic, dynamic>, Map<dynamic, dynamic>) areEqual})
// Adding a top-level function is a minor change.
---
```diff
@@ line 303: package:react/react_client/react_interop.dart @@
+ ReactComponentFactoryProxy memo2(ReactComponentFactoryProxy factory, {bool Function(Map
Showing results for e200d485c3e763085c924ce2763f507d27be1044
Powered by semver-audit-service. Please report any problems by filing an issue. Reported by the dart semver audit client 2.2.0 Browse public API.
Last edited UTC Aug 20 at 22:06:52
@aaronlademann-wf @smaifullerton-wk All feedback has been addressed! (including adding a test case for wrapping forwardRef2
with memo
)
QAing now... I think this just needs to be formatted?
- [x] Verify unit tests pass (CI passes)
- [x] Smoke test examples
- [x] Perform QA instructions in over_react PR
QA+1 for every step except:
QA +1
Motivation
Dart
forwardRef
components andmemo
-wrapped components were being passed JSified props due to the use of JS component factories, when they expected to be getting non-converted Dart props.Solution
tl;dr: I added
forwardRef2
/memo2
, added a bunch of tests around refs, and fixed a bunch of issues surfaced by test failures.Add
forwardRef2
andmemo2
, which return Dart component factories so they don't convert propsRemove prop de-converting logic from
forwardRef2
This was only a partial solution to wrapping JS components, only applying to callbacksAlso, now that we're using Dart component factories, this logic would prevent Dart event handlers from being converted.
So, since we'll need a more holistic solution to the problem of wrapping JS components, and it wouldn't be easy to retain this logic without breaking other behavior, it was removed.
Update common factory tests:
chainRef
works with refs that come from forwardRef2 callback args (as well as ReactElement, since it experienced a similar problem)Update event handler tests to not test de-conversion of props via
forwardRef
QA Instructions
uiForwardRef
andmemo
: https://github.com/Workiva/over_react/pull/620