Skip to content
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-9347 Add memo for function components #613

Merged
merged 4 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 31 additions & 24 deletions lib/over_react.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,38 @@
/// Base classes for UI components and related utilities.
library over_react;

export 'package:react/react.dart' show
SyntheticEvent,
SyntheticAnimationEvent,
SyntheticClipboardEvent,
SyntheticKeyboardEvent,
SyntheticFocusEvent,
SyntheticFormEvent,
SyntheticDataTransfer,
SyntheticMouseEvent,
SyntheticTouchEvent,
SyntheticTransitionEvent,
SyntheticUIEvent,
SyntheticWheelEvent,
TypedSnapshot;
export 'package:react/react.dart'
show
SyntheticEvent,
SyntheticAnimationEvent,
SyntheticClipboardEvent,
SyntheticKeyboardEvent,
SyntheticFocusEvent,
SyntheticFormEvent,
SyntheticDataTransfer,
SyntheticMouseEvent,
SyntheticTouchEvent,
SyntheticTransitionEvent,
SyntheticUIEvent,
SyntheticWheelEvent,
TypedSnapshot;

export 'package:react/react_client/js_backed_map.dart' show JsBackedMap;

export 'package:react/react_client.dart' show setClientConfiguration, ReactElement, ReactComponentFactoryProxy;
export 'package:react/react_client.dart'
show setClientConfiguration, ReactElement, ReactComponentFactoryProxy;
export 'package:react/react_client/react_interop.dart' show ReactErrorInfo, Ref;

export 'src/component/_deprecated/abstract_transition.dart';
export 'src/component/_deprecated/abstract_transition_props.dart';
export 'src/component/aria_mixin.dart';
export 'src/component/callback_typedefs.dart';
export 'src/component/_deprecated/error_boundary.dart';
export 'src/component/_deprecated/error_boundary_mixins.dart' hide LegacyErrorBoundaryApi;
export 'src/component/_deprecated/error_boundary_mixins.dart'
hide LegacyErrorBoundaryApi;
export 'src/component/dom_components.dart';
export 'src/component/error_boundary_api.dart' show defaultErrorBoundaryLoggerName;
export 'src/component/error_boundary_api.dart'
show defaultErrorBoundaryLoggerName;
export 'src/component/ref_util.dart';
export 'src/component/fragment_component.dart';
export 'src/component/strictmode_component.dart';
Expand All @@ -52,13 +56,15 @@ export 'src/component/prop_typedefs.dart';
export 'src/component/pure_component_mixin.dart';
export 'src/component/_deprecated/resize_sensor.dart';
export 'src/component_declaration/annotations.dart';
export 'src/component_declaration/builder_helpers.dart' hide GeneratedErrorMessages;
export 'src/component_declaration/component_base_2.dart' show
registerComponent2,
registerAbstractComponent2,
UiComponent2,
UiStatefulComponent2,
UiStatefulMixin2;
export 'src/component_declaration/builder_helpers.dart'
hide GeneratedErrorMessages;
export 'src/component_declaration/component_base_2.dart'
show
registerComponent2,
registerAbstractComponent2,
UiComponent2,
UiStatefulComponent2,
UiStatefulMixin2;
export 'src/component_declaration/built_redux_component.dart';
export 'src/component_declaration/flux_component.dart';
export 'src/component_declaration/function_component.dart';
Expand All @@ -74,6 +80,7 @@ export 'src/util/hoc.dart';
export 'src/util/handler_chain_util.dart';
export 'src/util/key_constants.dart';
export 'src/util/map_util.dart';
export 'src/util/memo.dart';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only code change. The other changes are from ddev format

export 'src/util/pretty_print.dart';
export 'src/util/prop_errors.dart';
export 'src/util/prop_key_util.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/memo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import 'package:over_react/component_base.dart';
/// ```
///
/// `memo` only affects props changes. If your function component wrapped in `memo` has a
/// [useState] or [useContext] Hook in its implementation, it will still rerender when `state` or `context` change.
/// `useState` or `useContext` Hook in its implementation, it will still rerender when `state` or `context` change.
///
/// By default it will only shallowly compare complex objects in the props map.
/// If you want control over the comparison, you can also provide a custom comparison
Expand Down