-
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-935 Add PureComponentMixin #499
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
+ And a custom Equality that is safe for ReactElement / Function() as props / state values in dart2js
f1c3da2
to
1197fa8
Compare
1197fa8
to
7d356bc
Compare
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.
Just a couple more things, really close!
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
+ To avoid conflicts with many pre-existing implementations in consumer libs + And export from over_react.dart instead of component.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.
+10
+ Becaues otherwise, `propTypes` cannot be overridden without analysis issues for components mixing in PureComponentMixin
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
/// Main entry point for `PureComponentMixin` testing | ||
main() { | ||
group('PureComponentMixin', () { | ||
const initialChildren = ['initial']; |
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.
Looks like we're only testing prop updates here. Should we also be testing the effect of state updates/non-updates?
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.
Probably not a huge deal since the implementation is the same as for props 🤷
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.
There is a test at the very beginning that uses forceUpdate
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.
Ah, I see it now 👍
@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
Consumers sometimes ask how to use
React.PureComponent
withOverReact
.Changes
PureComponentMixin
which will cause a component to behave likeReact.PureComponent
.Release Notes
Add
PureComponentMixin
to allow consumers to create components that mimicReact.PureComponent
behavior.Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review: @greglittlefield-wf @kealjones-wk
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: