-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Create an API for registering and replacing React components #2536
Conversation
* development: Fix order action button reverting status to processing (#2541)
Simply import component for tag item in tag list component
The issue with the Anyway, all issues discovered by @zenweasel were ironed out with my last few commits and our conversation in Slack. Thanks for the thorough code review! |
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.
Lots of good stuff here. I found very little not working, (media, etc all working now) and overall seems to be solid and ready to go.
i18n doesn't appear to be working (reactively) -> choose a new language and no changes. when you navigate, updates become visible, but this is a bug.
.babelrc
Outdated
@@ -0,0 +1,25 @@ | |||
{ |
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.
Is there a reason we're moving this back from package.json?
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 thinking here was for two reasons. NPM keeps jacking up the formatting and because babelrc
is a file specifically for this use. As our package.json continues to get longer, it's nice to not have it be a place for a bunch of different kinds of configs.
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.
true regarding npm jacking up the formatting. I had just moved the babelrc in 1.4 for the same reason -> as the number of aliases grow, the natural spot to maintain them all is in the same place where we load other packages.. my logic: why have our aliases hidden in babelrc... when it doesn't have to go there and we don't need to maintain multiple files..
(but hey-> let's go with this, for now, not a big deal to me, until I get annoyed by aliases I can't find again).
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.
fair enough
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.
- Would like to see i18n working.
- Currency doesn't appear to be changing on PDP variants. (same behavior as i18n)
- .babelrc reverted. (not a blocker)
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.
Error opening SMS settings..
meteor.js?hash=814eae5…:934 Error: In template smsSettings, call to `{{> React ... }}` missing `component` argument.
at Blaze.View.<anonymous> (react-template-helper.js:24)
at blaze.js?hash=f33d3df…:1934
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=f33d3df…:3744)
at blaze.js?hash=f33d3df…:1932```
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.
Error opening dashboard email panel:
20modules.js?hash=c62f8dd…:85278 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `ReactTable`.
in ReactTable (created by SortableTable)
in div (created by SortableTable)
in SortableTable (created by Reaction(EmailLogs))
in div (created by Reaction(CardBody))
in VelocityTransitionGroupChild (created by TransitionGroup)
in span (created by TransitionGroup)
in TransitionGroup (created by VelocityTransitionGroup)
in VelocityTransitionGroup (created by Reaction(CardBody))
in Reaction(CardBody) (created by Reaction(EmailLogs))
in div (created by Reaction(Card))
in Reaction(Card) (created by Reaction(EmailLogs))
in div (created by Reaction(CardGroup))
in Reaction(CardGroup) (created by Reaction(EmailLogs))
in Reaction(EmailLogs) (created by withProps(EmailLogs))
in withProps(EmailLogs) (created by Tracker(withProps(EmailLogs)))
in Tracker(withProps(EmailLogs))
printWarning @ modules.js?hash=c62f8dd…:85278
|
Yeah I just saw those email/SMS panel errors as well |
@jshimko might as well update the version to 1.5.0 as well -> this is big enough we're going to want to identify it in dev... |
SMS and email settings errors should be fixed. |
Version bumped to 1.5.0 |
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.
SMS/etc all looks good now. I'm still seeing some funky behavior with i18n and currency, although it is now acting reactively. Just switching languages/currency logged in and logged out, non-update elements start appearing. I have the feeling this should be a new issue, as I'm not sure it's enough to block this migrating to development.
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.
A couple of style notes and we need to figure out if importing from @reactioncommerce/reaction-components
is a local or an NPM import because we are doing it both ways. But I don't see anything here worth holding up the PR for.
@@ -0,0 +1,77 @@ | |||
import { composeWithTracker } from "./composer"; |
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.
Import order
@@ -1,10 +1,9 @@ | |||
import React from "react"; | |||
import { composeWithTracker } from "@reactioncommerce/reaction-components"; |
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.
Import order
} else { | ||
this.setState({ status: "error" }); | ||
componentWillMount() { | ||
const { settings } = this.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.
If we aren't using settings
, couldn't we destructure a nested object in one step? (says guy who just recently reread the destructuring docs)
@@ -0,0 +1,38 @@ | |||
import { compose, withProps } from "recompose"; |
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.
Generally I don't know if I am favor of renaming these. I found having container
in the name makes it easier to find the appropriate file, and no one died from being too explicit.
@@ -1,47 +1,50 @@ | |||
import React, { Component } from "react"; | |||
import React, { PureComponent } from "react"; |
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.
Also, if we are going to remove container
from some file names because they are in a container
directory we should probably do that everywhere.
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.
Totally agreed @zenweasel. Adding the word "container" to every file name felt really unnecessary to me when they're already in a /container
directory. Also, the base component name (without "container" appended) is how they should be referenced with the new API and you should be able to assume that the final component has that name regardless of whether higher order components are being used.
The only reason I didn't do it across the app is because I already edited almost 300 files. The PR had to end somewhere. :)
But yeah, as components get updated to use the new API, my vote is to remove the container from the name and standardize things.
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.
Yeah, I am against renaming these but oh well.
Logger.error(error); | ||
throw new Meteor.Error(error); | ||
} | ||
Meteor.call("products/updateProductPosition", productId, position, tag, error => { |
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 inherited code but since I noticed) Parenthesis around error
?
@jshimko @zenweasel has some valid style points... but I couldn't take it anymore.. merged to development. |
This adds and uses an API for registering/replacing React components across the Reaction UI. Most of the front end of Reaction has been registered (and is now replaceable). Registering the admin components will come afterward in a separate PR.
Several new higher order components (HOC's) have been added for common use cases (injecting the current user, checking whether they are admin or owner, etc). More details in the docs (link below).
With the merge of this PR, we will need to discuss as a group what the workflow for adding new components and HOC's looks like so that we make sure to have consistency. One of the hardest parts of all of these updates was that there was not a lot of consistency in how components were structured and a lot of them were not set up in a way that made overrides or customization easy to implement. Hopefully this new pattern will solve that.
For more detail, see preliminary docs PR branch:
https://github.com/reactioncommerce/reaction-docs/blob/components-api/developer/components/API.md