Skip to content

Implement React.memo #252

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

Merged
merged 3 commits into from
Feb 10, 2020
Merged

Implement React.memo #252

merged 3 commits into from
Feb 10, 2020

Conversation

aaronlademann-wf
Copy link
Collaborator

@aaronlademann-wf aaronlademann-wf commented Jan 24, 2020

This is not a clean diff. It will not be clean until #251 merges

This PR implements React.memo in the Dart API, along with examples and tests.


FYA: @greglittlefield-wf @sydneyjodon-wk @joebingham-wk

@aaronlademann-wf aaronlademann-wf marked this pull request as ready for review January 24, 2020 20:48
Copy link
Collaborator

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

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

A few unused imports that were probably just auto-pulled in while writing the test, but otherwise everything looked great!

@@ -0,0 +1,163 @@
import 'dart:async';
Copy link
Collaborator

Choose a reason for hiding this comment

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

#nit unused import

Suggested change
import 'dart:async';

@@ -0,0 +1,163 @@
import 'dart:async';
import 'dart:developer';
Copy link
Collaborator

Choose a reason for hiding this comment

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

#nit unused import

Suggested change
import 'dart:developer';

import 'dart:developer';
@TestOn('browser')
import 'dart:html';
import 'dart:js_util';
Copy link
Collaborator

Choose a reason for hiding this comment

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

#nit unused import

Suggested change
import 'dart:js_util';

Copy link
Collaborator

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

+1

@override
render() {
return react.div(
{'key': 'mtdw'},
Copy link
Collaborator

Choose a reason for hiding this comment

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

#nit this key is unnecessary

return react.div(
{'key': 'mtdw'},
MemoTest({
'localCount': this.state['localCount'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

#nit As per the Dart style guide, avoid unnecessary this

Copy link
Collaborator

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

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

Used the profiler to verify that the props are memoized and the time to commit decreases.

QA +1

# Conflicts:
#	lib/react_client/react_interop.dart
Copy link
Collaborator

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

+10

@greglittlefield-wf greglittlefield-wf merged commit 370051c into 5.4.0-wip Feb 10, 2020
@greglittlefield-wf greglittlefield-wf deleted the 5.4.0/memo branch February 16, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants