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-6104 Add over_react_redux example app #439

Merged
merged 37 commits into from
Jan 23, 2020

Conversation

aaronlademann-wf
Copy link
Contributor

@aaronlademann-wf aaronlademann-wf commented Dec 10, 2019

These changes add a full-featured example application within app/over_react_redux/todo_client that showcases what the over_react_redux lib can do!

To try out the app... pull down this branch. Then...

cd app/over_react_redux/todo_client
pub get
webdev serve

then navigate to http://localhost:8080


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

@aviary-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

+ This is what dartlang expects, and we get docked for not doing it this way when pana analyzes the repo.
@aaronlademann-wf aaronlademann-wf force-pushed the CPLAT-6104_over_react_redux_example_app branch 5 times, most recently from 6eef3ce to 5dc886a Compare December 11, 2019 19:55
@aaronlademann-wf aaronlademann-wf force-pushed the CPLAT-6104_over_react_redux_example_app branch from 5dc886a to 2fe3179 Compare December 12, 2019 15:22
@aaronlademann-wf aaronlademann-wf marked this pull request as ready for review December 12, 2019 19:57
Copy link
Contributor

@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.

This app is awesome. The components are all super elegant and there's lots of cool stuff (utilities / techniques) in there. I'm very excited to have this be the example for a Redux app.

I found a few nitpicky things. Given that it's an example app pretty much all of it is just a suggestion and there aren't any show stoppers. Thank you for working so hard on this!

);
}

// TODO: Look into the cloneElement issue with the missing/problematic SyntheticEvent wrapper that forces us to use dynamic here
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice to make a ticket for this and reference it here!

Copy link
Contributor

@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.

Looks really good, just a couple small things!

Copy link
Contributor

@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.

Done with first pass, looks awesome overall though!

.packages
.pub
packages
*.over_react.g.dart
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these ignored? This package is build_to: source so it shouldn't need them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're thinking about the over_react package @greglittlefield-wf - this app is its own package - which does not specify build_to: source.

Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops, sorry, I meant build_to: cache. I always get those mixed up 😓

But yeah, since they're cache, they should only ever exist inside the .dart_tool directory within this repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Bump on this.

@dave-doty
Copy link

It would be super helpful if this example app also had a few unit tests (and possibly some kind of end-to-end tests), to show suggested examples how to do unit testing of reducer logic, components, and whatever else. (middleware?)

+ Apparently this was added in built_redux 7.5.9
.packages
.pub
packages
*.over_react.g.dart
Copy link
Contributor

Choose a reason for hiding this comment

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

Bump on this.


@override
@mustCallSuper
void componentDidUpdate(_, __, [___]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any mixin that overrides lifecycle methods should always call super, otherwise lifecycle overrides from parent classes or other mixins won't get called.

@@ -18,11 +18,12 @@ UiFactory<UserSelectorProps> ConnectedUserSelector = connect<AppState, UserSelec
mapStateToPropsWithOwnProps: (state, ownProps) {
return (UserSelector()
..selectedUser = ownProps.selectedUserId.isNotEmpty
? state.users.firstWhere((user) => user.id == ownProps.selectedUserId)
? state.users.singleWhere((user) => user.id == ownProps.selectedUserId, orElse: () => null)
Copy link
Contributor

Choose a reason for hiding this comment

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

#FYI singleWhere iterates the full list to validate there are no other matches, whereas firstWhere short-circuits, so the latter may be preferable in perf-sensitive areas where you can assume there won't be dupes.

if (!muiJsIsAvailable()) return;
}

JsBackedMap getJsProps(Ref ref) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be unused

Copy link
Contributor

@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.

The new tests look awesome! I think it establishes a really simple and effective pattern, and the redraw mixin in dope.

Pretty much everything I caught was super little nit picky - feel free to resolve any of those that don't seem worth worrying about. Otherwise I just had a couple small questions

joebingham-wk
joebingham-wk previously approved these changes Jan 22, 2020
Copy link
Contributor

@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.

  • Code looks awesome!
  • Ran the app and tested functionality
  • Used devtools to inspect updates

+10

import 'dart:js';

import 'package:over_react/over_react.dart';
import 'package:react/react_client/react_interop.dart';
Copy link
Contributor

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 'package:react/react_client/react_interop.dart';

Copy link
Contributor

@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

Again, awesome work on this @aaronlademann-wf!!

@greglittlefield-wf
Copy link
Contributor

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-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 from RM

@rm-astro-wf rm-astro-wf merged commit e06a3a3 into master Jan 23, 2020
@rm-astro-wf rm-astro-wf deleted the CPLAT-6104_over_react_redux_example_app branch January 23, 2020 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants