-
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-9347 Add memo for function components #613
CPLAT-9347 Add memo for function components #613
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
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
Would be nice to address those ignore comments / formatting, but not a blocker for approval
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
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'ing now!
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.
QA'ing worked great! I just used the HOC in an example to verify it acted as I'd expect. Pulling it down though, I realize a small nit and then also - this PR doesn't add an export of the API to the over_react library. Let me know if there's a reason we weren't exporting, but I'd assume we'd want to.
Once the export is added (and nit addressed, if ya feel like it 🤷♂️ ), I can +10 and merge!
lib/src/util/memo.dart
Outdated
/// ``` | ||
/// | ||
/// `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. |
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.
#nit there's just some lints from this (docs ref here):
/// [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. |
@@ -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'; |
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 is the only code change. The other changes are from ddev format
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.
+10
@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 from RM
Motivation
We'd like a typed
memo
util to wrap the react-dart memo function to memoize function components.Changes
memo
with support for over_react typing for function componentsregisterComponentTypeAlias
so function components can be registered accordinglyenforceFunctionComponent
utilmemo
Release Notes
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: