-
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-6104 Add over_react_redux example app #439
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
34535a2
to
a3c24d3
Compare
+ This is what dartlang expects, and we get docked for not doing it this way when pana analyzes the repo.
6eef3ce
to
5dc886a
Compare
5dc886a
to
2fe3179
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.
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!
app/over_react_redux/todo_client/lib/src/components/shared/list_item_mixin.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/shared/material_ui.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/shared/material_ui.dart
Show resolved
Hide resolved
); | ||
} | ||
|
||
// TODO: Look into the cloneElement issue with the missing/problematic SyntheticEvent wrapper that forces us to use dynamic here |
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.
It might be nice to make a ticket for this and reference it here!
app/over_react_redux/todo_client/lib/src/components/shared/todo_item_text_field.dart
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/user_selector.dart
Outdated
Show resolved
Hide resolved
…eact_redux_example_app
+ Use extension methods! + Fix some problematic comparison logic + Simplify top level traversal
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 really good, just a couple small things!
app/over_react_redux/todo_client/lib/src/components/shared/list_item_mixin.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/shared/list_item_mixin.dart
Outdated
Show resolved
Hide resolved
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.
Done with first pass, looks awesome overall though!
.packages | ||
.pub | ||
packages | ||
*.over_react.g.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.
Why are these ignored? This package is build_to: source
so it shouldn't need them
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.
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
.
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.
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.
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.
Bump on this.
app/over_react_redux/todo_client/lib/src/components/shared/avatar_with_colors.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/user_selector.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/app_bar/app_bar_local_storage_menu.dart
Outdated
Show resolved
Hide resolved
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 |
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.
Bump on this.
|
||
@override | ||
@mustCallSuper | ||
void componentDidUpdate(_, __, [___]) { |
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.
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) |
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.
#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) { |
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 seems to be unused
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.
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
app/over_react_redux/todo_client/lib/src/components/todo_list.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/user_list.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/user_list_item.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/lib/src/components/user_selector.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart
Outdated
Show resolved
Hide resolved
app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart
Outdated
Show resolved
Hide resolved
Localstorage reducer/middleware cleanup
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.
- 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'; |
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 unused import
import 'package:react/react_client/react_interop.dart'; |
c87e308
to
5a84e2a
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.
@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
These changes add a full-featured example application within
app/over_react_redux/todo_client
that showcases what theover_react_redux
lib can do!To try out the app... pull down this branch. Then...
then navigate to http://localhost:8080
FYA @greglittlefield-wf @joebingham-wk @kealjones-wk @sydneyjodon-wk