Skip to content

Commit

Permalink
remove wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
kealjones-wk committed Oct 2, 2024
1 parent 0cc1b79 commit 3edb048
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions lib/src/util/lazy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,7 @@ UiFactory<TProps> lazy<TProps extends UiProps>(

final lazyFactoryProxy = react.lazy(() async {
final factory = await load();
// By using a wrapper uiForwardRef ensures that we have a matching factory proxy type given to react-dart's lazy,
// a `ReactDartWrappedComponentFactoryProxy`. This is necessary to have consistent prop conversions since we don't
// have access to the original factory proxy outside of this async block.
final wrapper = uiForwardRef<TProps>(
(props, ref) {
final builder = factory()
..addProps(props)
..ref = ref;
return props.children == null || (props.children != null && props.children?.isEmpty != false)
? builder()
: builder(props.children);
},
UiFactoryConfig(
propsFactory: propsFactory,
displayName: _config.displayName != null ? 'lazy(${_config.displayName})' : 'lazy(anonymous)'
),
);
return wrapper().componentFactory!;
return factory().componentFactory!;
});

if (propsFactory == null) {
Expand Down

0 comments on commit 3edb048

Please sign in to comment.